/* ==========================================================================
   صفحه‌ی پیش‌نمایش سنگ (Visualizer) — نسخه‌ی یکپارچه
   همه‌ی استایل صفحه همین‌جاست (قبلاً بین دو بلوک <style> داخل ویو و این فایل پخش بود).
   رنگ‌ها هم‌خانواده‌ی صفحه‌ی اصلی: قهوه‌ای تیره / طلایی؛ دکمه‌ها از .btn-primary / .btn-outline خودِ سایت.
   ========================================================================== */
:root {
  --viz-deep: #2B241D;
  --viz-accent: #C8956C;
  --viz-accent-dark: #7A4824;   /* برای متن روی زمینه‌ی روشن (کنتراست کافی)؛ #C8956C فقط برای خط و پس‌زمینه */
  --viz-sand: #faf7f4;
  --viz-sand-2: #f4ece3;
  --viz-line: #e7e0d8;
  --viz-line-2: #ddd3c8;
  --viz-ink: #2C3E50;
  --viz-muted: #66707a;
  --viz-ok: #2e7d32;
  --viz-warn: #a05a1e;
  --viz-radius: 16px;
}

/* ───────── مقدمه (هیرو) ───────── */
.viz-intro { background: var(--viz-sand); border-bottom: 1px solid var(--viz-line); padding: 38px 0 34px; }
.viz-intro-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.viz-intro h2 { font-size: clamp(1.45rem, 2.6vw, 2.05rem); line-height: 1.6; color: var(--viz-deep); margin: 0 0 12px; }
.viz-lead { color: #4a5560; font-size: 1.02rem; line-height: 2; max-width: 62ch; margin: 0 0 20px; }
.viz-assure { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.viz-assure li { display: flex; gap: 10px; align-items: flex-start; font-size: .93rem; line-height: 1.85; color: #3d4852; }
.viz-assure svg { flex: none; width: 22px; height: 22px; margin-top: 4px; color: var(--viz-accent-dark); }
.viz-assure a { color: var(--viz-accent-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.viz-preselected-banner {
  display: inline-block; margin: 0 0 16px; padding: 9px 16px; border-radius: 10px;
  background: rgba(46,125,50,.09); color: #1f6a2a; font-size: .92rem; font-weight: 600; line-height: 1.8;
}
.viz-flow { list-style: none; margin: 0; padding: 8px 22px; background: #fff; border: 1px solid var(--viz-line); border-radius: var(--viz-radius); box-shadow: 0 8px 28px rgba(43,36,29,.06); }
.viz-flow li { display: flex; gap: 14px; align-items: center; padding: 15px 0; }
.viz-flow li + li { border-top: 1px dashed var(--viz-line-2); }
.viz-flow-ic { flex: none; width: 48px; height: 48px; border-radius: 12px; background: var(--viz-sand-2); color: var(--viz-accent-dark); display: grid; place-items: center; }
.viz-flow-ic svg { width: 25px; height: 25px; }
.viz-flow b { display: block; color: var(--viz-deep); font-size: .98rem; line-height: 1.7; }
.viz-flow .s { display: block; font-size: .85rem; color: var(--viz-muted); line-height: 1.8; }

/* ───────── ابزار ───────── */
.visualizer-page { padding: 38px 0 56px; overflow-x: clip; }
.visualizer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.visualizer-grid > * { min-width: 0; }
.visualizer-form, .visualizer-result {
  background: #fff; border: 1px solid var(--viz-line); border-radius: var(--viz-radius);
  box-shadow: 0 8px 28px rgba(43,36,29,.06); padding: 26px;
}
.visualizer-result { min-height: 380px; display: flex; align-items: center; justify-content: center; }
@media (min-width: 901px) { .visualizer-result { position: sticky; top: 90px; align-self: start; } }

.viz-step { margin-bottom: 28px; }
.viz-step h3 { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; line-height: 1.7; color: var(--viz-deep); margin: 0 0 8px; }
.viz-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--viz-deep); color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 700; }
.viz-hint { color: var(--viz-muted); font-size: 13px; line-height: 1.9; margin: 0 0 10px; }
.viz-tips { margin-top: 8px; font-size: 13px; }

/* آپلود */
.viz-upload-box {
  display: flex; align-items: center; justify-content: center; cursor: pointer; aspect-ratio: 4 / 3; min-height: 0; overflow: hidden;
  border: 2px dashed var(--viz-line-2); border-radius: 14px; background: var(--viz-sand);
  transition: border-color .15s, background-color .15s;
}
.viz-upload-box:hover, .viz-upload-box:focus-visible { border-color: var(--viz-accent); background: #fdf9f4; }
.viz-upload-box.drag { border-color: var(--viz-accent-dark); background: rgba(200,149,108,.14); }
.viz-upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--viz-muted); text-align: center; padding: 16px; line-height: 1.8; }
.viz-upload-placeholder svg { width: 42px; height: 42px; color: var(--viz-accent-dark); }
.viz-upload-placeholder strong { color: var(--viz-deep); font-size: .98rem; }
.viz-photo-preview { width: 100%; height: 100%; object-fit: contain; background: #f1eee9; }
.viz-upload-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.viz-tool { min-height: 40px; }

/* جست‌وجو و فیلتر */
.viz-search-input { margin-bottom: 10px; }
.viz-chips { display: flex; gap: 8px; margin: 10px 0 4px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.viz-chip {
  flex: 0 0 auto; font: inherit; font-size: 13px; cursor: pointer; min-height: 36px;
  padding: 4px 14px; border-radius: 999px; border: 1px solid var(--viz-line-2); background: #fff; color: var(--viz-ink);
}
.viz-chip[aria-pressed="true"] { background: var(--viz-deep); border-color: var(--viz-deep); color: #fff; }
.viz-count { font-size: 12px; color: var(--viz-muted); margin: 6px 0 8px; min-height: 1.4em; }
.viz-count.empty { color: var(--viz-warn); font-size: 14px; padding: 10px 12px; background: #fff6ec; border-radius: 8px; }

.viz-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; max-height: 420px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.viz-product-item { cursor: pointer; border: 2px solid transparent; border-radius: 10px; text-align: center; padding: 4px; transition: border-color .15s, background-color .15s; }
.viz-product-item:hover { background: var(--viz-sand); }
.viz-product-item img { width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: cover; border-radius: 8px; background: #f1eee9; }
.viz-product-item span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; line-height: 1.6; min-height: 3.2em; margin-top: 4px; color: var(--viz-ink); }
.viz-product-item.selected { border-color: var(--viz-accent-dark); background: rgba(200,149,108,.12); }
.viz-more { display: block; width: 100%; margin-top: 10px; min-height: 44px; }
.viz-more[hidden] { display: none; }

.viz-image-picker { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--viz-line); }
.viz-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; max-height: 220px; overflow-y: auto; padding: 4px; }
.viz-image-item { position: relative; cursor: pointer; border: 2px solid transparent; border-radius: 8px; overflow: hidden; aspect-ratio: 1 / 1; transition: border-color .15s; }
.viz-image-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viz-image-item.selected { border-color: var(--viz-accent-dark); box-shadow: 0 0 0 2px rgba(200,149,108,.3); }
.viz-image-item .viz-image-badge { position: absolute; bottom: 2px; inset-inline-end: 2px; background: rgba(0,0,0,.6); color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 4px; }
.viz-image-item .viz-image-check { position: absolute; top: 4px; inset-inline-start: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--viz-accent-dark); color: #fff; font-size: 10px; display: none; align-items: center; justify-content: center; }
.viz-image-item.selected .viz-image-check { display: flex; }

.viz-product-item:focus-visible, .viz-chip:focus-visible, .viz-tool:focus-visible, .viz-upload-box:focus-visible,
.viz-zoom-bar button:focus-visible, .viz-c-zoom:focus-visible, .viz-c-range:focus-visible + .viz-c-handle { outline: 3px solid var(--viz-accent-dark); outline-offset: 2px; }

/* محل اعمال */
.viz-surface-options { display: flex; flex-wrap: wrap; gap: 10px; }
.viz-radio { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 44px; padding: 6px 14px; border: 1px solid var(--viz-line-2); border-radius: 10px; background: #fff; }
.viz-radio:has(input:checked) { border-color: var(--viz-accent-dark); background: rgba(200,149,108,.12); font-weight: 600; }

/* سهمیه */
.viz-quota-note { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-size: 14px; line-height: 1.9; background: #F4F6F8; color: #4A5568; }
.viz-quota-note.viz-quota-empty { background: #FDECEA; color: #A93226; }
.viz-quota-note.viz-quota-login { background: #FEF5E7; color: #8a5a0c; }
.viz-quota-note a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* خلاصه و دکمه‌ی ساخت */
.viz-summary { margin: 14px 0 10px; padding: 12px 14px; border: 1px solid var(--viz-line); border-radius: 10px; background: var(--viz-sand); }
.viz-sum-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.viz-sum-list .todo { color: var(--viz-warn); }
.viz-sum-list .ok::before { content: "✓ "; color: var(--viz-ok); }
.viz-sum-list .todo::before { content: "○ "; }
.viz-sum-msg { margin: 0; font-size: 13px; color: var(--viz-muted); }
.viz-sum-msg.ready { color: var(--viz-ok); font-weight: 600; }
.viz-submit-btn { width: 100%; min-height: 52px; border: none; cursor: pointer; font-weight: 700; font-size: 1.02rem; }
.viz-submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.viz-privacy { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; font-size: 12.5px; line-height: 1.9; color: var(--viz-muted); }
.viz-privacy svg { flex: none; width: 18px; height: 18px; margin-top: 3px; color: var(--viz-accent-dark); }
.viz-privacy a { color: var(--viz-accent-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.viz-error { color: #b3261e; margin-top: 10px; font-size: 14px; line-height: 1.8; }

/* ───────── پنل نتیجه ───────── */
.viz-result-empty, .viz-result-loading { text-align: center; color: var(--viz-muted); width: 100%; }
.viz-result-empty svg { width: 150px; height: auto; color: var(--viz-line-2); margin: 0 auto 6px; display: block; }
.viz-result-empty p { color: var(--viz-deep); font-weight: 700; margin: 8px 0 12px; }
.viz-empty-list { list-style: none; margin: 0 auto; padding: 0; display: inline-grid; gap: 6px; text-align: start; font-size: .88rem; line-height: 1.8; }
.viz-empty-list li::before { content: "✓"; color: var(--viz-accent-dark); font-weight: 700; margin-inline-end: 8px; }

.viz-result-loading { padding: 20px 18px; border-radius: 12px; background: linear-gradient(180deg, rgba(200,149,108,.07), rgba(200,149,108,.01)); }
.viz-result-loading p { margin-top: 14px; color: var(--viz-deep); font-weight: 600; }
.viz-spinner-wrap { position: relative; width: 64px; height: 64px; margin: 0 auto; }
.viz-spinner-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--viz-accent-dark); border-inline-end-color: rgba(200,149,108,.35); animation: viz-spin 1.4s linear infinite; }
.viz-spinner-ring-2 { inset: 10px; border-top-color: rgba(200,149,108,.7); border-inline-end-color: transparent; animation-duration: 2.2s; animation-direction: reverse; }
.viz-spinner-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; animation: viz-pulse 1.8s ease-in-out infinite; }
@keyframes viz-spin { to { transform: rotate(360deg); } }
@keyframes viz-pulse { 0%, 100% { opacity: .65; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes viz-shimmer { to { background-position: 340px 0; } }

.viz-stages { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 12px auto 0; max-width: 340px; }
.viz-stage { font-size: 12px; color: #8a8a8a; padding: 4px 10px; border-radius: 999px; background: #f1efec; transition: color .3s, background-color .3s, transform .3s; }
.viz-stage[data-active="true"] { color: #fff; background: var(--viz-deep); transform: scale(1.04); }
.viz-progress-track { width: 100%; max-width: 300px; height: 6px; border-radius: 999px; background: #ece7e1; margin: 16px auto 6px; overflow: hidden; }
.viz-progress-fill {
  height: 100%; background-color: var(--viz-accent); border-radius: 999px; transition: width 1s linear;
  background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent); background-size: 60px 100%; background-repeat: no-repeat; background-position: -60px 0;
  animation: viz-shimmer 1.6s linear infinite;
}
.viz-progress-meta { font-size: 12px; color: #8a8a8a; margin: 0 0 8px; }
.viz-loading-tip { font-size: 13.5px; color: #4a5560; max-width: 340px; margin: 10px auto 0; min-height: 22px; line-height: 1.9; transition: opacity .3s; }
.viz-loading-hint { font-size: 12.5px; color: var(--viz-muted); max-width: 340px; margin: 10px auto 0; line-height: 1.9; }
.viz-trust-note { display: flex; gap: 8px; align-items: flex-start; justify-content: center; text-align: start; font-size: 12.5px; color: var(--viz-muted); max-width: 340px; margin: 12px auto 0; line-height: 1.9; }
.viz-trust-note svg { flex: none; width: 17px; height: 17px; margin-top: 3px; color: var(--viz-accent-dark); }
.viz-notify-btn { margin-top: 14px; font-size: 12px; padding: 8px 14px; }

.viz-result-done { width: 100%; }
.viz-after-only img { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: none; object-fit: contain; background: #f1eee9; border-radius: 10px; }
.viz-ba-label { display: block; font-size: 12px; color: var(--viz-muted); margin-bottom: 6px; }

/* اسلایدر قبل/بعد (جهت ثابت LTR تا «قبل» همیشه چپ باشد) */
.viz-compare { position: relative; direction: ltr; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: #f1eee9; touch-action: pan-y; user-select: none; }
.viz-compare img { display: block; width: 100%; height: 100%; object-fit: contain; }
.viz-c-before { position: relative; }
.viz-c-after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.viz-c-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.viz-c-handle::after { content: "↔"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 40px; height: 40px; border-radius: 50%; background: #fff; color: #333; display: grid; place-items: center; font-size: 18px; box-shadow: 0 1px 6px rgba(0,0,0,.35); }
.viz-c-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.viz-c-tag { position: absolute; top: 10px; padding: 2px 10px; border-radius: 6px; background: rgba(0,0,0,.58); color: #fff; font-size: 12px; pointer-events: none; }
.viz-c-tag.left { left: 10px; } .viz-c-tag.right { right: 10px; }
.viz-c-zoom { position: absolute; z-index: 3; bottom: 10px; right: 10px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.96); color: var(--viz-deep); display: grid; place-items: center; cursor: zoom-in; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.viz-c-zoom svg { width: 22px; height: 22px; }

/* راهنمای ۳‌خطی */
.viz-advice { margin: 16px 0; padding: 16px 18px; border: 1px solid var(--viz-line); border-inline-start: 4px solid var(--viz-accent); border-radius: 12px; background: #fffdfa; }
.viz-advice[hidden] { display: none; }
.viz-adv-title { margin: 0 0 8px; font-size: 16px; color: var(--viz-accent-dark); }
.viz-adv-list { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.9; color: var(--viz-ink); }
.viz-adv-by, .viz-adv-wait { margin: 10px 0 0; font-size: 12px; color: var(--viz-muted); }
.viz-adv-alt { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px; border: 1px solid var(--viz-line); border-radius: 10px; background: #fff; text-decoration: none; color: inherit; }
.viz-adv-alt img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.viz-adv-alt span { display: grid; font-size: 14px; }
.viz-adv-alt small { color: var(--viz-muted); font-size: 12px; }

/* مسیر ادامه بعد از نتیجه */
.viz-funnel { margin-top: 18px; padding: 18px; border-radius: 14px; background: var(--viz-sand); border: 1px solid var(--viz-line); }
.viz-funnel-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.viz-funnel-label { font-size: 12px; color: var(--viz-muted); }
#vizFunnelName { font-size: 1.1rem; color: var(--viz-deep); line-height: 1.7; }
.viz-funnel-price { font-size: 14px; color: var(--viz-accent-dark); font-weight: 700; }
.viz-funnel-note { font-size: 12px; color: var(--viz-muted); line-height: 1.8; }
.viz-funnel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.viz-funnel-actions a { text-align: center; text-decoration: none; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.viz-funnel-actions .viz-fa-main { grid-column: 1 / -1; }
.viz-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.viz-result-actions a, .viz-result-actions button { min-height: 44px; text-decoration: none; }
.viz-used { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--viz-line); border-radius: 10px; background: var(--viz-sand); }
.viz-used h4 { margin: 0 0 6px; font-size: 14px; }
.viz-used ul { margin: 0; padding-inline-start: 20px; font-size: 14px; line-height: 2; }
.viz-used a { color: var(--viz-accent-dark); font-weight: 600; }

/* ───────── بزرگ‌نمایی (نمای تمام‌صفحه) ───────── */
.viz-dialog { width: min(98vw, 1400px); height: min(96dvh, 920px); max-height: 96dvh; padding: 0; border: 0; border-radius: 14px; background: #111; overflow: hidden; }
.viz-dialog[open] { display: flex; flex-direction: column; }
.viz-dialog::backdrop { background: rgba(0,0,0,.82); }
.viz-dialog-x { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 5; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #fff; font-size: 18px; cursor: pointer; }
.viz-zoom-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; cursor: grab; background: #111; }
.viz-zoom-stage.panning { cursor: grabbing; }
.viz-zoom-layer { position: absolute; inset: 0; display: grid; place-items: center; transform-origin: 50% 50%; will-change: transform; }
.viz-zoom-layer .viz-compare { width: min(100%, calc((100dvh - 140px) * 4 / 3)); max-height: none; margin: 0 auto; border-radius: 0; }
.viz-zoom-layer .viz-c-range, .viz-zoom-layer .viz-c-zoom { pointer-events: none; display: none; }
.viz-zoom-layer img.viz-zoom-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viz-zoom-layer img { -webkit-user-drag: none; }
.viz-zoom-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #1b1b1b; color: #fff; direction: ltr; }
.viz-zoom-bar button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #fff; color: #111; font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.viz-zoom-bar .viz-zoom-pct { min-width: 56px; text-align: center; font-size: 14px; }
.viz-zoom-pos { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.viz-zoom-pos input { width: min(34vw, 220px); }

/* ───────── طرح ترکیبی، سبک و سلیقه (اختیاری) ───────── */
.viz-planner { border: 1px dashed var(--viz-line-2); border-radius: 12px; background: #fffdfa; }
.viz-planner > summary { cursor: pointer; padding: 14px 16px; min-height: 48px; list-style: none; display: flex; align-items: center; gap: 6px; color: var(--viz-accent-dark); font-weight: 600; }
.viz-planner > summary::-webkit-details-marker { display: none; }
.viz-planner > summary::after { content: "▾"; margin-inline-start: auto; transition: transform .15s; }
.viz-planner[open] > summary::after { transform: rotate(180deg); }
.viz-planner > summary small { color: var(--viz-muted); font-weight: 400; }
.viz-pl-body { padding: 4px 16px 16px; display: grid; gap: 18px; }
.viz-pl-sec h4 { margin: 0 0 6px; font-size: 14px; color: var(--viz-ink); }
.viz-pl-sec .viz-chips { margin: 0 0 10px; }
.viz-pl-sel { font: inherit; font-size: 14px; min-height: 40px; padding: 4px 10px; border: 1px solid var(--viz-line-2); border-radius: 8px; background: #fff; max-width: 100%; }
.viz-pl-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.viz-pl-add label { font-size: 13px; color: var(--viz-muted); }
.viz-pl-msg { margin: 4px 0 8px; font-size: 13px; color: var(--viz-warn); min-height: 1.3em; }
.viz-zones { display: grid; gap: 10px; }
.viz-zone { padding: 10px 12px; border: 1px solid var(--viz-line); border-radius: 10px; background: #fff; display: grid; gap: 8px; }
.viz-zone-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.viz-zone-stones { display: flex; flex-wrap: wrap; gap: 6px; }
.viz-stone-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--viz-sand-2); font-size: 13px; }
.viz-stone-chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.viz-x { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 13px; color: #777; }
.viz-x:hover { background: rgba(0,0,0,.07); }
.viz-sug { display: grid; gap: 8px; margin-top: 10px; }
.viz-sug-card { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--viz-line); border-radius: 10px; background: #fff; }
.viz-sug-card img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; }
.viz-sug-tx { display: grid; flex: 1; min-width: 0; font-size: 14px; }
.viz-sug-tx small { color: var(--viz-muted); font-size: 12px; }
.viz-insp-box { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.viz-insp-box img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; }

/* ───────── زیر ابزار: راهنما، پرسش‌ها، اعتماد، تماس ───────── */
.viz-sec { padding: 52px 0; }
.viz-sec + .viz-sec { padding-top: 0; }
.viz-sec h2 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); color: var(--viz-deep); margin: 0 0 12px; line-height: 1.7; }
.viz-sec-sub { color: #4a5560; line-height: 2; max-width: 70ch; margin: 0 0 22px; }
.viz-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.viz-card { background: #fff; border: 1px solid var(--viz-line); border-radius: var(--viz-radius); padding: 22px 24px; }
.viz-card h3 { font-size: 1.05rem; color: var(--viz-deep); margin: 0 0 12px; }
.viz-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.viz-checks li { display: flex; gap: 10px; line-height: 1.9; font-size: .94rem; color: #3d4852; }
.viz-checks li::before { content: "✓"; flex: none; width: 22px; height: 22px; margin-top: 3px; border-radius: 50%; background: var(--viz-sand-2); color: var(--viz-accent-dark); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.viz-seo-list { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; line-height: 1.9; font-size: .94rem; color: #3d4852; }
.viz-seo-tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.viz-seo-tags li { padding: 5px 14px; border-radius: 999px; background: var(--viz-sand-2); color: var(--viz-accent-dark); font-size: .88rem; }
.viz-seo-tags a { color: inherit; text-decoration: none; }
.viz-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.viz-links a { font-weight: 700; color: var(--viz-accent-dark); text-decoration: underline; text-underline-offset: 3px; }

.viz-faq details { background: #fff; border: 1px solid var(--viz-line); border-radius: 12px; margin-bottom: 10px; }
.viz-faq summary { cursor: pointer; list-style: none; padding: 16px 18px; min-height: 52px; font-weight: 700; color: var(--viz-deep); line-height: 1.8; display: flex; align-items: center; gap: 10px; }
.viz-faq summary::-webkit-details-marker { display: none; }
.viz-faq summary::after { content: "+"; margin-inline-start: auto; font-size: 22px; color: var(--viz-accent-dark); transition: transform .15s; }
.viz-faq details[open] summary::after { transform: rotate(45deg); }
.viz-faq details p { margin: 0; padding: 0 18px 16px; line-height: 2; color: #4a5560; font-size: .94rem; }

.viz-proof { background: var(--viz-deep); color: #fff; padding: 34px 0; }
.viz-proof-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; text-align: center; }
.viz-proof-num { display: block; font-size: 2rem; font-weight: 800; color: var(--viz-accent); line-height: 1.4; }
.viz-proof-label { font-size: .9rem; color: #e8dfd5; }

.viz-cta { background: linear-gradient(135deg, var(--viz-deep), #4a3626); color: #fff; padding: 46px 0; }
.viz-cta-box { max-width: 760px; margin: 0 auto; text-align: center; }
.viz-cta h2 { color: #fff; font-size: clamp(1.3rem, 2.4vw, 1.75rem); margin: 0 0 10px; line-height: 1.7; }
.viz-cta p { color: #ecdfd2; line-height: 2; margin: 0 0 22px; }
.viz-cta-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.viz-cta-actions a { min-height: 48px; padding: 0 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; font-weight: 700; text-decoration: none; }
.viz-cta-actions .viz-cta-main { background: #fff; color: var(--viz-deep); }
.viz-cta-actions .viz-cta-alt { border: 2px solid rgba(255,255,255,.7); color: #fff; }
.viz-cta-actions a:focus-visible { outline: 3px solid var(--viz-accent); outline-offset: 3px; }

.viz-article { padding: 28px 30px; background: #fff; border: 1px solid var(--viz-line); border-radius: var(--viz-radius); line-height: 2; color: var(--viz-ink); }
.viz-article h2 { font-size: 1.4rem; margin: 0 0 14px; }
.viz-article img { max-width: 100%; height: auto; }

/* ───────── موبایل و تبلت ───────── */
@media (max-width: 900px) {
  .viz-intro { padding: 26px 0 22px; }
  .viz-intro-grid { grid-template-columns: 1fr; gap: 22px; }
  .viz-flow { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 12px 8px; }
  .viz-flow li { flex-direction: column; text-align: center; gap: 8px; padding: 6px 8px; }
  .viz-flow li + li { border-top: 0; border-inline-start: 1px dashed var(--viz-line-2); }
  .viz-flow .s { display: none; }
  .viz-flow b { font-size: .86rem; }
  .visualizer-grid { grid-template-columns: 1fr; }
  .viz-two { grid-template-columns: 1fr; }
  .viz-sec { padding: 36px 0; }
}
@media (max-width: 700px) {
  .visualizer-page { padding-top: 22px; padding-bottom: 36px; }
  .visualizer-form, .visualizer-result { padding: 16px; }
  .visualizer-result { min-height: 280px; }
  .viz-search-input { font-size: 16px; min-height: 46px; }   /* ۱۶px: جلوگیری از زوم خودکار iOS */
  .viz-upload-tools .viz-tool { flex: 1 1 100%; min-height: 48px; }
  .viz-product-grid { grid-template-columns: repeat(3, 1fr); max-height: none; overflow: visible; gap: 8px; padding: 0; }
  .viz-product-grid.collapsed .viz-product-item:nth-child(n + 10) { display: none; }
  .viz-image-grid { grid-template-columns: repeat(4, 1fr); max-height: none; overflow: visible; }
  .viz-surface-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
  .viz-radio { justify-content: center; }

  /* دکمه‌ی ساخت همیشه در دسترس؛ دکمه‌های شناور چت و بازگشت به بالا بالاتر می‌روند تا روی آن نیفتند */
  .viz-submit-bar { position: sticky; bottom: 0; z-index: 20; margin: 0 -16px -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--viz-line); box-shadow: 0 -6px 16px rgba(0,0,0,.08); }
  body.has-viz-bar .chat-widget, body.has-viz-bar .scroll-top { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .viz-summary { margin: 0 0 8px; padding: 0; border: 0; background: none; }
  .viz-sum-list { display: none; }
  .viz-sum-msg { font-size: 13px; text-align: center; }

  .viz-result-actions > * { flex: 1 1 45%; }
  .viz-funnel-actions { grid-template-columns: 1fr; }
  .viz-compare { border-radius: 8px; }
  .viz-c-handle::after { width: 44px; height: 44px; }
  .viz-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .viz-zoom-pos input { width: 38vw; }
  .viz-pl-body { padding: 4px 12px 14px; }
  .viz-pl-add .viz-pl-sel, .viz-pl-add .viz-tool { flex: 1 1 100%; min-height: 46px; }
  .viz-sug-card .viz-tool { flex: none; }
  .viz-article { padding: 20px 18px; }
  .viz-cta-actions a { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .viz-spinner-ring, .viz-spinner-ring-2, .viz-spinner-icon, .viz-progress-fill { animation: none !important; }
  * { scroll-behavior: auto !important; transition: none !important; }
}
