/* رِدا — شاشة التجربة الافتراضية */
.tryon-cta { display: flex; align-items: center; gap: 14px; width: 100%; margin: 4px 0 18px; padding: 14px 16px; border-radius: 16px;
  border: 1px solid var(--line); background: linear-gradient(135deg, #f2f6fc, #fff); cursor: pointer; text-align: start; color: var(--ink);
  transition: border-color .2s, box-shadow .2s, transform .2s; }
.tryon-cta:hover { border-color: var(--gold); box-shadow: 0 14px 30px -22px rgba(12,31,69,.5); transform: translateY(-1px); }
.tryon-cta .ic { width: 48px; height: 48px; border-radius: 14px; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.tryon-cta .ic svg { width: 24px; height: 24px; }
.tryon-cta b { display: block; font-size: 16px; }
.tryon-cta small { color: var(--muted); font-size: 13px; }
.tryon-cta .go { margin-inline-start: auto; color: var(--gold); }
.tryon-cta .go svg { width: 20px; height: 20px; }

.tryon { position: fixed; inset: 0; z-index: 120; background: rgba(8, 16, 36, .72); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; }
.to-panel { position: relative; width: min(980px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 22px; display: grid; grid-template-rows: auto 1fr auto; }
.to-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.to-head h2 { font-size: 22px; }
.to-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.to-x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--ink); flex: none; }
.to-x svg { width: 20px; height: 20px; }

.to-stage { position: relative; background: #0c1a36; aspect-ratio: 16 / 10; max-height: 62vh; width: 100%; overflow: hidden; }
.to-stage video, .to-stage .to-still, .to-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tryon.mirror video, .tryon.mirror canvas { transform: scaleX(-1); }
.to-guide { position: absolute; inset: 8% 32%; border: 2px dashed rgba(255,255,255,.35); border-radius: 120px 120px 24px 24px; pointer-events: none; transition: opacity .4s; }
.to-guide i { position: absolute; left: 50%; top: 6%; width: 22%; aspect-ratio: 1; transform: translateX(-50%); border: 2px dashed rgba(255,255,255,.35); border-radius: 50%; }
.tryon.tracking .to-guide { opacity: 0; }
.to-msg { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(12, 31, 69, .85); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px); text-align: center; }
.to-msg[hidden] { display: none; }

.to-controls { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 16px 20px; }
.to-colors { display: flex; gap: 10px; }
.to-colors button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.to-colors button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }
.to-size { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.to-size input { width: 100%; accent-color: var(--ink); }
.to-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.to-actions [hidden] { display: none !important; }
.to-actions .btn { min-height: 44px; padding: 0 18px; font-size: 14px; }
.to-snap svg { width: 18px; height: 18px; }

.to-result { position: absolute; inset: 0; background: rgba(255,255,255,.97); border-radius: 22px; display: grid; place-items: center; gap: 14px; padding: 24px; align-content: center; }
.to-result[hidden] { display: none; }
.to-result img { max-height: 70vh; max-width: 100%; border-radius: 16px; box-shadow: 0 20px 50px -25px rgba(12,31,69,.5); }

@media (max-width: 720px) {
  .tryon { padding: 0; }
  .to-panel { border-radius: 0; max-height: 100vh; height: 100vh; }
  .to-stage { aspect-ratio: auto; max-height: none; height: 100%; }
  .to-guide { inset: 8% 18%; }
  .to-controls { grid-template-columns: 1fr; gap: 12px; padding: 12px 16px 20px; }
  .to-colors { justify-content: center; }
  .to-actions { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .to-guide { transition: none; } }

/* countdown before the AI shot */
.to-count { position: absolute; inset: 0; display: grid; place-items: center; font: 400 min(30vw, 180px)/1 var(--f-head); color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.45); pointer-events: none; }
.to-count[hidden] { display: none; }
.to-count.pop { animation: toPop .9s var(--ease); }
@keyframes toPop { from { transform: scale(1.4); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); opacity: .9; } }

/* AI result: before / after */
.to-ai-view { position: absolute; inset: 78px 0 0 0; z-index: 5; background: #fff; border-radius: 0 0 22px 22px; display: grid; grid-template-rows: 1fr auto; overflow: hidden; }
.to-ai-view[hidden] { display: none; }
.to-ba { position: relative; background: #0c1a36; min-height: 0; --cut: 100%; }
.to-ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.to-ba-after { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--cut)) 0 0); }
.to-ba input { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 2; accent-color: #fff; }
.to-ba-tag { position: absolute; top: 12px; z-index: 2; background: rgba(12,31,69,.75); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.to-ba-tag.b { right: 12px; } .to-ba-tag.a { left: 12px; }
.to-loading { position: absolute; inset: 0; z-index: 3; display: none; place-content: center; justify-items: center; gap: 8px; color: #fff; text-align: center; padding: 20px;
  background: rgba(12, 26, 54, .55); backdrop-filter: blur(6px); }
.to-loading i { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: toSpin 1s linear infinite; }
.to-loading b { font-size: 17px; } .to-loading small { opacity: .8; }
.to-ai-view.busy .to-loading, .to-ai-view.failed .to-loading { display: grid; }
.to-ai-view.failed .to-loading i { display: none; }
.to-ai-view.busy .to-ba input, .to-ai-view.busy .to-ba-tag { display: none; }
@keyframes toSpin { to { transform: rotate(360deg); } }
.to-ai-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
.to-ai-save:not([href]) { opacity: .5; pointer-events: none; }
.to-panel { position: relative; }
@media (prefers-reduced-motion: reduce) { .to-count.pop, .to-loading i { animation: none; } }

/* big shutter: «صوّريني بالعباية» */
.to-stage .to-ai { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 12px;
  padding: 8px 22px 8px 8px; border: 0; border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer; font: 600 16px var(--f-body);
  box-shadow: 0 14px 36px -12px rgba(0,0,0,.55); transition: transform .2s var(--ease), opacity .2s; }
.to-stage .to-ai .ring { width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.to-stage .to-ai .ring svg { width: 24px; height: 24px; }
.to-stage .to-ai:hover:not([disabled]) { transform: translateX(-50%) scale(1.04); }
.to-stage .to-ai[disabled] { opacity: .55; cursor: default; }
.to-stage .to-msg { bottom: 104px; }
.to-mid { display: grid; gap: 8px; }
.to-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 32px; }
.to-toggle input { width: 18px; height: 18px; accent-color: var(--ink); }
.to-toggle small { color: var(--muted); }
.tryon:not(.overlay) .to-size, .tryon:not(.overlay) .to-snap { display: none; }
.to-canvas, .tryon:not(.overlay) .to-gl, .tryon:not(.overlay) .to-occ { visibility: hidden; }
.to-occ { pointer-events: none; }
.to-gl { pointer-events: none; }
