/* المراية السحرية — try-on studio */
.mx { max-width: 1180px; margin: 0 auto; padding: 18px 16px calc(40px + env(safe-area-inset-bottom)); }
.mx-head { text-align: center; max-width: 640px; margin: 10px auto 18px; }
.mx-head .eyebrow { color: var(--rose); font-weight: 700; font-size: .85rem; margin: 0 0 6px; }
.mx-head h1 { font-family: "El Messiri", "Playfair Display", serif; font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 8px; color: var(--ink); }
[dir="ltr"] .mx-head h1 { font-family: "Playfair Display", serif; letter-spacing: -0.02em; }
.mx-head h1 em { font-family: "Aref Ruqaa", "El Messiri", serif; font-style: normal; color: var(--rose); }
[dir="ltr"] .mx-head h1 em { font-family: "Playfair Display", serif; font-style: italic; }

.mx-tabs { display: flex; gap: 6px; justify-content: center; padding: 5px; margin: 0 auto 16px; width: fit-content; max-width: 100%; overflow-x: auto;
  background: #fff; border: var(--hair); border-radius: 18px; box-shadow: var(--sh-1); scrollbar-width: none; }
.mx-tabs button { font: inherit; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 10px 16px; border-radius: 14px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; transition: background-color 200ms var(--ease-out), color 200ms ease, transform 120ms var(--ease-out); }
.mx-tabs button.on { background: var(--plum); color: #fff; }
.mx-tabs button:active { transform: scale(.96); }
.t-ico { font-size: 1.1rem; }

.mx-stage { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .mx-stage { grid-template-columns: 1fr; } }

.stage { position: relative; aspect-ratio: 3 / 4; max-height: 78vh; width: 100%; margin: 0 auto; border-radius: 28px; overflow: hidden;
  background: radial-gradient(80% 60% at 50% 30%, #fff, #f6e6ea); border: var(--hair); box-shadow: var(--sh-2); }
.stage video { display: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage.mirrored canvas { transform: scaleX(-1); }
.stage-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.stage-empty .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stage-empty p { margin: 0; color: var(--muted); max-width: 24em; }
.mirror-ico { width: 120px; aspect-ratio: 3 / 4; border-radius: 999px 999px 18px 18px; border: 2px solid var(--rosegold);
  background: linear-gradient(200deg, #fff 10%, #f3d9e0 60%, #e9c6d0); box-shadow: 0 0 0 10px rgba(201, 148, 130, .12); position: relative; overflow: hidden; }
.mirror-ico::after { content: ""; position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.9) 50%, transparent 58%); animation: mx-shine 3.6s var(--ease-in-out) infinite; }
@keyframes mx-shine { from { transform: translateX(-60%); } 60%, to { transform: translateX(60%); } }
.stage-load { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: rgba(255, 250, 247, .8);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); z-index: 3; }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--blush); border-top-color: var(--rose); animation: mx-spin .8s linear infinite; }
@keyframes mx-spin { to { transform: rotate(360deg); } }
.stage-tools { position: absolute; z-index: 2; inset-inline: 0; bottom: 14px; display: flex; justify-content: center; gap: 10px; }
.tool { font: inherit; font-weight: 700; font-size: .85rem; min-width: 52px; height: 52px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .6);
  background: rgba(255, 255, 255, .72); color: var(--plum); -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
  box-shadow: 0 8px 22px rgba(42, 23, 38, .2); cursor: pointer; transition: transform 120ms var(--ease-out); touch-action: manipulation; }
.tool:active { transform: scale(.94); }
#snap { width: 64px; height: 64px; background: var(--plum); color: #fff; border-color: transparent; }
#snap .ic { width: 26px; height: 26px; }
.face-card { position: absolute; z-index: 2; top: 14px; inset-inline: 14px; padding: 14px 16px; border-radius: 20px; background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%); box-shadow: var(--sh-2); font-size: .9rem; }
.face-card small { color: var(--muted); } .face-card b { display: block; font-family: "El Messiri", "Playfair Display", serif; font-size: 1.5rem; color: var(--plum); }
.face-card p { margin: 6px 0 0; } .face-card p span { display: inline-block; min-width: 46px; font-weight: 700; color: var(--rose); margin-inline-end: 6px; }
.face-card em { display: block; margin-top: 8px; color: var(--muted); font-size: .78rem; font-style: normal; }

.mx-side { display: grid; gap: 14px; }
.panel { background: #fff; border: var(--hair); border-radius: 24px; padding: 18px; box-shadow: var(--sh-1); }
.panel h2 { font-size: 1.1rem; margin: 0; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 10px; margin: 14px 0; }
.sw { aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer; background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.55), transparent 38%), var(--c);
  box-shadow: inset 0 -3px 6px rgba(0,0,0,.18), 0 2px 6px rgba(42,23,38,.15); transition: transform 140ms var(--ease-out), box-shadow 200ms ease; }
.sw.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--plum); transform: scale(1.06); }
.sw:active { transform: scale(.92); }
.slider { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; font-size: .9rem; color: var(--muted); }
.slider input { accent-color: var(--plum); }
.tip { margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; background: var(--blush); font-size: .9rem; line-height: 1.8; }
.mini-sw { font: inherit; font-size: .8rem; border: 0; border-radius: 999px; padding: 3px 10px 3px 8px; margin: 2px; cursor: pointer; background: #fff; color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(74,35,70,.12); }
.mini-sw::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-inline-end: 6px; vertical-align: -1px; }
.cta { display: grid; gap: 10px; background: linear-gradient(160deg, #fff, var(--blush)); }
.cta b { font-family: "El Messiri", "Playfair Display", serif; font-size: 1.2rem; }
.chip-c { justify-self: start; display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; padding: 4px 12px 4px 6px; border-radius: 999px; background: #fff; box-shadow: var(--sh-1); }
.chip-c::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--c); }
.privacy { margin: 0; font-size: .82rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.privacy .ic { color: var(--ok, #1f9d5c); }

@media (prefers-reduced-motion: reduce) { .mirror-ico::after { animation: none; } }
@media (max-width: 520px) {
  .mx-tabs { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .mx-tabs button { flex-direction: column; gap: 2px; padding: 8px 2px; font-size: .78rem; justify-content: center; }
}
