: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: radial-gradient(90% 60% at 50% 0%, rgba(137, 126, 255, 0.18), transparent 60%), var(--bg);
  color: var(--ink);
  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: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#overlay { position: fixed; inset: 0; pointer-events: none; }
#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;
}
