/* Upgrade 3: share-story screen (#story). Prefix: .sty-
   A phone-shaped live preview of the 1080×1920 canvas next to a glass options panel. */
.sty-wrap { max-width: 1060px; margin: 0 auto; padding-bottom: 12px; }
.sty-head { text-align: center; margin: 10px auto 22px; max-width: 640px; }
.sty-title { font-size: clamp(30px, 5vw, 50px); margin: 12px 0 8px; }
.sty-sub { margin: 0 auto; color: var(--ink-2); font-size: 14.5px; max-width: 52ch; }
.sty-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 28px; align-items: start; }
.sty-stage { position: sticky; top: 80px; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* phone-like preview frame with a soft 3D tilt */
.sty-phone { position: relative; width: min(100%, 340px); padding: 10px; border-radius: 38px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .03) 40%, rgba(255, 255, 255, .08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 0 0 1px rgba(255, 255, 255, .08), 0 40px 80px -30px rgba(0, 0, 0, .85), 0 0 70px -20px rgba(242, 196, 109, .35);
  transform: perspective(1400px) rotateY(-5deg) rotateX(2deg); transition: transform .5s ease; }
html[dir="rtl"] .sty-phone { transform: perspective(1400px) rotateY(5deg) rotateX(2deg); }
.sty-phone:hover { transform: perspective(1400px) rotateY(0) rotateX(0); }
.sty-phone canvas { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 28px; background: #07080A; }
.sty-wait { position: absolute; inset: 10px; display: grid; place-items: center; border-radius: 28px; pointer-events: none; }
.sty-spin { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(242, 196, 109, .25); border-top-color: #F2CF85; animation: stySpin .9s linear infinite; margin-top: 40%; }
@keyframes stySpin { to { transform: rotate(360deg); } }

.sty-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(100%, 340px); }
.sty-actions .sty-share { grid-column: 1 / -1; }
.sty-actions .btn { width: 100%; }
.sty-actions .btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sty-actions .btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.sty-msg { margin: 0; width: min(100%, 340px); text-align: center; font-size: 13px; color: #F6CF8C; }

/* options panel */
.sty-panel { padding: 22px; }
.sty-sec { margin: 0 0 20px; }
.sty-h { margin: 0 0 10px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.sty-tpls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sty-tpl { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px; border-radius: 16px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .02); color: var(--ink-2); cursor: pointer; font-size: 13px; transition: border-color .2s, background .2s, transform .2s; }
.sty-tpl:hover { border-color: rgba(255, 255, 255, .28); transform: translateY(-2px); }
.sty-tpl[aria-pressed="true"] { color: var(--ink); border-color: rgba(242, 196, 109, .6); background: rgba(242, 196, 109, .07); box-shadow: 0 0 22px -8px rgba(242, 196, 109, .6); }
.sty-sw { width: 46px; height: 66px; border-radius: 10px; background: radial-gradient(70% 45% at 50% 40%, color-mix(in srgb, var(--b) 70%, transparent), transparent 75%), var(--a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 6px 16px -6px rgba(0, 0, 0, .6); position: relative; }
.sty-sw::after { content: ""; position: absolute; left: 12px; right: 12px; top: 26px; height: 9px; clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%); background: var(--b); opacity: .95; }
.sty-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sty-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .02); color: var(--ink-2); cursor: pointer; font-size: 13px; white-space: nowrap; }
.sty-chip:hover { color: var(--ink); border-color: rgba(255, 255, 255, .28); }
.sty-ck { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; }
.sty-chip[aria-pressed="true"] { color: var(--ink); border-color: rgba(242, 196, 109, .5); background: rgba(242, 196, 109, .07); }
.sty-chip[aria-pressed="true"] .sty-ck { border-color: transparent; background: linear-gradient(180deg, #FFF0C8, #E2AE4B); }
.sty-ck svg { width: 12px; height: 12px; fill: none; stroke: #1A1204; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.sty-chip[aria-pressed="true"] .sty-ck svg { opacity: 1; }
.sty-tpl:focus-visible, .sty-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sty-text { margin: 4px 0 0; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); }
.sty-text summary { cursor: pointer; padding: 10px 14px; font-size: 13px; color: var(--ink-2); }
.sty-text pre { margin: 0; padding: 0 14px 14px; white-space: pre-wrap; font: 13px/1.7 var(--font-ar); color: var(--ink-2); max-height: 260px; overflow: auto; }
.sty-note { margin-top: 14px; line-height: 1.7; }

@media (max-width: 860px) {
  .sty-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .sty-stage { position: static; }
  .sty-phone { width: min(62vw, 260px); padding: 8px; border-radius: 30px; transform: none; }
  .sty-phone canvas { border-radius: 22px; }
  .sty-head { margin-bottom: 14px; }
  .sty-sub { font-size: 13.5px; }
  html[dir="rtl"] .sty-phone { transform: none; }
  .sty-actions, .sty-msg { width: 100%; max-width: 420px; }
  .sty-panel { padding: 18px 16px; }
}
@media (max-width: 380px) { .sty-tpl { font-size: 12px; padding: 10px 4px; } .sty-chip { padding: 0 12px 0 10px; } }
/* phones and touch screens: every control here is at least 40 px tall */
@media (max-width: 600px), (pointer: coarse) {
  .sty-panel .seg.sm button, .sty-chip { height: 40px; }
  .sty-panel .seg.sm button { min-width: 44px; flex-shrink: 0; } /* "عربي" is narrow */
  .sty-text summary { padding-block: 12px; }
}

/* light theme */
html[data-theme="light"] .sty-phone { background: linear-gradient(160deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .55) 40%, rgba(255, 255, 255, .8));
  box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgba(16, 48, 36, .1), 0 40px 70px -30px rgba(16, 48, 36, .45), 0 0 60px -20px rgba(201, 149, 47, .35); }
html[data-theme="light"] .sty-tpl, html[data-theme="light"] .sty-chip { background: rgba(255, 255, 255, .6); }
html[data-theme="light"] .sty-tpl[aria-pressed="true"], html[data-theme="light"] .sty-chip[aria-pressed="true"] { border-color: rgba(169, 119, 31, .55); background: rgba(240, 190, 100, .16); box-shadow: 0 6px 16px -10px rgba(169, 119, 31, .7); }
html[data-theme="light"] .sty-text { background: rgba(255, 255, 255, .55); }
html[data-theme="light"] .sty-msg { color: #8A5A12; }
html[data-theme="light"] .sty-tpl:focus-visible, html[data-theme="light"] .sty-chip:focus-visible { outline-color: #A9771F; }

@media (prefers-reduced-motion: reduce) { .sty-phone, .sty-tpl { transition: none; } .sty-spin { animation: none; } .sty-phone:hover { transform: none; } }
html[data-theme="light"] .sty-sw { box-shadow: inset 0 0 0 1px rgba(16, 48, 36, .2), 0 6px 14px -8px rgba(16, 48, 36, .5); }
