:root {
  --accent: #897eff;
  --ink: #fff;
  --ink-2: rgba(255, 255, 255, 0.74);
  --ink-3: rgba(255, 255, 255, 0.5);
  --glass: rgba(14, 14, 20, 0.72);
  --line: rgba(255, 255, 255, 0.14);
  --bg: #07070b;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: #fff;
  color: #161c24;
  font-family: "IRANSans", Vazirmatn, Tahoma, Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
button, a { font-family: inherit; }

#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#overlay { position: fixed; inset: 0; pointer-events: none; color: var(--ink); }
#overlay > * { pointer-events: auto; }
body.in-ar #overlay { pointer-events: auto; }

/* ---------- نوار بالا (در AR) ---------- */
.top {
  position: absolute; top: calc(var(--safe-t) + 14px); inset-inline: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; pointer-events: none;
}
.top > * { pointer-events: auto; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--glass); color: var(--ink); display: grid; place-items: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); cursor: pointer; flex: none;
}
.step {
  font-size: 12px; color: var(--ink-2); background: var(--glass); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

/* ---------- راهنما و دکمه‌ها (در AR) ---------- */
.step { display: none; }
.dims {
  flex: 1; min-width: 0; text-align: center; font-size: 13px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75), 0 0 12px rgba(0, 0, 0, 0.5); pointer-events: none;
}
.panel {
  position: absolute; inset-inline: 16px; bottom: calc(var(--safe-b) + 120px); margin-inline: auto; width: min(100% - 32px, 380px);
  background: rgba(14, 14, 20, 0.88); border: 1px solid var(--line); border-radius: 20px; padding: 6px 4px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; min-height: 58px; cursor: pointer; }
.row + .row { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.row .ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: rgba(137, 126, 255, 0.18); color: #cfcaff; flex: none; }
.row .txt { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.5; }
.row .txt small { display: block; font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.row.off { opacity: 0.45; pointer-events: none; }
.sw {
  appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 999px; flex: none; margin: 0;
  background: rgba(255, 255, 255, 0.2); position: relative; transition: background 0.2s; cursor: pointer;
}
.sw::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.sw:checked { background: #6a5cff; }
.sw:checked::after { transform: translateX(-18px); }
html[dir="ltr"] .sw:checked::after { transform: translateX(18px); }
.hint {
  position: absolute; inset-inline: 20px; bottom: calc(var(--safe-b) + 132px);
  margin-inline: auto; width: fit-content; max-width: min(90vw, 380px);
  text-align: center; font-size: 15px; font-weight: 600; line-height: 1.7; color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75), 0 0 14px rgba(0, 0, 0, 0.55); pointer-events: none;
}
.controls {
  position: absolute; inset-inline: 16px; bottom: calc(var(--safe-b) + 54px);
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--glass); color: var(--ink);
  border-radius: 999px; padding: 0 20px; font-size: 14px; font-weight: 600; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); min-height: 50px;
}
.pill:active { background: rgba(137, 126, 255, 0.35); }

.scan-anim {
  position: absolute; top: 38%; left: 50%; margin: -22px 0 0 -22px; pointer-events: none;
  animation: sweep 2.2s ease-in-out infinite; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}
@keyframes sweep { 0%, 100% { transform: translateX(-34px) rotate(-12deg); } 50% { transform: translateX(34px) rotate(12deg); } }

/* ---------- صفحهٔ ورود: فقط مدل و یک دکمه ---------- */
.landing {
  position: absolute; inset-inline: 0; bottom: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 0 20px calc(var(--safe-b) + 54px);
}
.landing > * { pointer-events: auto; }
.actions { width: min(100%, 360px); text-align: center; }
.cta {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 54px;
  border: 0; border-radius: 18px; font-size: 15.5px; font-weight: 700; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, #897eff, #6a5cff); cursor: pointer;
  box-shadow: 0 10px 30px rgba(106, 92, 255, 0.35);
}
.cta:active { filter: brightness(0.9); }
.cta:disabled { opacity: 0.6; }
.cta img { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.note { margin: 12px 4px 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.8; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.place {
  position: absolute; bottom: calc(var(--safe-b) + 52px); inset-inline: 0; margin-inline: auto; width: min(86vw, 360px);
}
.spinner {
  position: absolute; top: 50%; left: 50%; margin: -17px 0 0 -17px;
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite; pointer-events: none;
}
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
body.in-ar .landing { display: none; }

/* ---------- نشان Powered by ARmo (مثل digikala) ---------- */
.armo-badge {
  position: fixed; bottom: 20px; left: 20px; z-index: 15;
  display: inline-flex; align-items: center; gap: 6px; box-sizing: border-box; padding: 0;
  background: none; border: 0; box-shadow: none;
  font: 400 11px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: normal; color: rgba(255, 255, 255, 0.5); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap; text-decoration: none; direction: ltr; pointer-events: auto;
  transition: color 0.3s; -webkit-tap-highlight-color: transparent;
}
.armo-badge:hover { color: #fff; }
.armo-badge .armo-badge-logo { font-weight: 800; letter-spacing: 0.5px; color: #fff; }
body.in-ar .armo-badge { pointer-events: none; }
@media (max-width: 768px) {
  .armo-badge { bottom: 15px; left: 15px; font-size: 10px; }
}

@media (max-width: 359px) {
  .pill { padding: 9px 12px; font-size: 12px; }
  .cta { font-size: 14.5px; }
}
@media (min-width: 900px) {
  .landing { padding-bottom: 72px; }
}
.panel:not([hidden]) ~ .hint { visibility: hidden; }
.rg { display: block; width: 100%; margin: 8px 0 2px; accent-color: #8c7fff; height: 22px; }
.row.bright { cursor: default; }
.panel { max-height: calc(100dvh - 230px); overflow-y: auto; }

.tools { display: flex; gap: 8px; pointer-events: none; }
.tools > * { pointer-events: auto; }
a.icon-btn { text-decoration: none; }
.cta-row { display: flex; gap: 10px; align-items: stretch; }
.cta-row .cta { flex: 1; width: auto; min-width: 0; }
.round {
  width: 54px; height: 54px; flex: none; border-radius: 18px; border: 1px solid var(--line); background: var(--glass); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; text-decoration: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.round:active { background: rgba(137, 126, 255, 0.35); }
.toast {
  position: absolute; inset-inline: 0; margin-inline: auto; width: fit-content; max-width: 86vw; top: calc(var(--safe-t) + 70px);
  background: rgba(14, 14, 20, 0.9); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font-size: 13px; pointer-events: none;
}

/* ================= نمای سه‌بعدی (طراحی مثل webar: روشن، نوار پایین، دکمهٔ بنفش) ================= */
:root { --brand: #5e35b1; --brand-dark: #4527a0; --line-l: #dfe3e8; --muted-l: #637381; }
body.in-ar #app { visibility: hidden; }
body:not(.in-ar) #overlay .armo-badge { display: none; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; background: #fff; color: #161c24; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.progress {
  position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 5; overflow: hidden; background: rgba(94, 53, 177, 0.12);
}
.progress::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--brand); border-radius: 3px;
  animation: slide 1.1s ease-in-out infinite;
}
.progress[hidden] { display: none; }
@keyframes slide { 0% { left: -40%; } 100% { left: 100%; } }
.rot-hint {
  position: absolute; bottom: 16px; left: 0; right: 0; margin-inline: auto; width: fit-content; z-index: 4;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 600;
  background: rgba(18, 18, 18, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none;
  opacity: 1; transition: opacity 0.5s ease;
}
.rot-hint.fade { opacity: 0; }
.bar {
  flex: none; padding: 12px 16px calc(12px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line-l);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06); z-index: 10;
}
.bar .actions { width: min(100%, 480px); margin: 0 auto; text-align: center; }
.bar .cta-row { display: flex; gap: 10px; align-items: stretch; }
.bar .cta {
  flex: 1; min-width: 0; min-height: 52px; gap: 8px; border-radius: 16px; font-size: 16px; font-weight: 600;
  background: var(--brand); box-shadow: none; color: #fff;
}
.bar .cta:active { background: var(--brand-dark); filter: none; }
.bar .cta svg { flex: none; }
.shop {
  flex: none; min-height: 52px; min-width: 52px; padding: 0 12px; border-radius: 16px; border: 1px solid #b6a6dc; background: #fff;
  color: var(--brand); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.shop:active { background: rgba(94, 53, 177, 0.08); }
.shop .lbl { display: none; }
@media (min-width: 400px) { .shop.js-shop .lbl { display: inline; } .shop.js-shop { padding: 0 16px; } }
.bar .note { color: var(--muted-l); text-shadow: none; margin: 10px 4px 0; font-size: 13px; }
.powered {
  display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 10px; text-decoration: none; direction: ltr;
  font: 400 10px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #919eab;
}
.powered b { font-weight: 800; letter-spacing: 0.5px; color: #161c24; }
.qr-card { border: 1px solid var(--line-l); border-radius: 16px; padding: 20px; text-align: center; margin-bottom: 16px; }
.qr-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.qr { display: inline-block; line-height: 0; }
.qr svg { width: 200px; height: 200px; }
.qr-sub { margin: 10px 0 0; font-size: 12px; color: var(--muted-l); }

/* دسکتاپ: صحنهٔ ۶۲٪ با گوشهٔ گرد + ستون کنار (کارت QR) */
@media (min-width: 900px) {
  #app { flex-direction: row; max-width: 1200px; margin: 0 auto; padding: 32px; gap: 32px; }
  .stage { flex: 0 0 62%; border-radius: 24px; background: #f9fafb; }
  .bar { flex: 1; min-width: 0; border: 0; box-shadow: none; padding: 0; display: flex; flex-direction: column; justify-content: center; align-items: stretch; }
  .bar .actions { width: 100%; max-width: 400px; margin: 0 auto; }
  .qr-card { max-width: 400px; width: 100%; margin: 0 auto 16px; }
  .powered { font-size: 11px; }
}
@media (max-width: 359px) {
  .bar .cta { font-size: 14px; gap: 6px; }
  .bar .cta svg { width: 22px; height: 22px; }
  .shop { min-width: 46px; padding: 0 8px; }
  .bar .cta-row { gap: 8px; }
}

/* ---------- نوار عکس‌های showroom (بدون نام؛ فقط عکس) ---------- */
.strip { display: flex; gap: 8px; }
.thumb {
  flex: none; padding: 0; margin: 0; width: 52px; height: 52px; border-radius: 14px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: #eef0f3; opacity: 0.7; transition: opacity 0.2s, border-color 0.2s, transform 0.2s;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.thumb[aria-pressed="true"] { opacity: 1; border-color: var(--brand); transform: scale(1.05); }
.thumb:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.thumb.loading { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .thumb, .thumb.loading { transition: none; animation: none; } }
.strip-page {
  overflow-x: auto; padding: 2px 4px 12px; max-width: 480px; margin: 0 auto; touch-action: pan-x; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.strip-page::-webkit-scrollbar { display: none; }
.strip-page .thumb:first-child { margin-inline-start: auto; }
.strip-page .thumb:last-child { margin-inline-end: auto; }
.strip-ar {
  position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); flex-direction: column;
  max-height: min(calc(100dvh - 220px), 246px); overflow-y: auto; padding: 6px; border-radius: 26px; touch-action: pan-y; scrollbar-width: none;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.strip-ar::-webkit-scrollbar { display: none; }
.strip-ar .thumb { width: 44px; height: 44px; border-radius: 50%; border-color: rgba(255, 255, 255, 0.25); opacity: 0.8; }
.strip-ar .thumb[aria-pressed="true"] { border-color: #fff; opacity: 1; }
body:not(.in-ar) .strip-ar { display: none; }
.panel:not([hidden]) ~ .strip-ar { visibility: hidden; }
@media (min-width: 900px) {
  .strip-page { max-width: 400px; margin-bottom: 8px; }
}

/* عکس‌ها از جا بیشتر است: لبه‌ها محو می‌شوند (۱۰ محصول یا بیشتر) */
.strip-ar.more { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%); }
.strip-page.more { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%); }
.strip-ar { scroll-snap-type: y proximity; }
.strip-ar .thumb { scroll-snap-align: center; }
/* نوار عکس‌ها در AR: متن راهنما زیرش نمی‌رود */
.strip-ar:not([hidden]) ~ .hint { inset-inline: 76px 20px; width: auto; max-width: none; margin-inline: 0; }

/* ---------- صفحهٔ آغازین (/) ---------- */
.splash { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: #fff; }
.splash img { animation: pulse 1.6s ease-in-out infinite; }
body.home #app, body.home #overlay { display: none; }

/* ---------- نوار بالای صحنه: زبان و لوگوی سازمان ---------- */
.stage-top { position: absolute; top: 12px; inset-inline: 12px; z-index: 6; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.icon-btn.light { width: 40px; height: 40px; border: 1px solid var(--line-l); background: rgba(255, 255, 255, 0.92); color: #161c24; font-size: 12px; font-weight: 700; cursor: pointer; border-radius: 50%; }
.org-logo { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; }
body.in-ar .stage-top { display: none; }

/* ---------- سازمان‌ها ---------- */
body.no-powered .powered, body.no-powered .armo-badge { display: none !important; }
body.brand-black .bar .cta { background: #000; }
body.brand-black .bar .cta:active { background: #222; }
body.brand-black .shop { color: #000; border-color: #bbb; }
body.brand-black .thumb[aria-pressed="true"] { border-color: #000; }
.shop.retry { margin: 10px auto 0; padding: 0 20px; }

/* ---------- راهنمای سه‌قدمی ---------- */
.guide { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(14, 14, 20, 0.6); }
.guide-card { width: min(100%, 380px); background: #fff; color: #161c24; border-radius: 22px; padding: 22px 20px 18px; }
.guide-card h2 { margin: 0 0 14px; font-size: 17px; text-align: center; }
.guide-card ol { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; }
.guide-card li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.7; }
.guide-card .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.guide-card .cta { width: 100%; background: var(--brand); box-shadow: none; }
body.brand-black .guide-card .n, body.brand-black .guide-card .cta { background: #000; }
