/* ══════════════ الهوية البصرية: زيتون الجليل، رَقّ دافئ، ذهب هادئ ══════════════ */
:root {
  color-scheme: light;
  --bg: #f5efe2;
  --surface: #fffcf5;
  --ink: #1f261c;
  --muted: #5f604f;
  --line: #e2d8c3;
  --olive: #3f5a36;
  --olive-deep: #26381f;
  --gold: #a8833a;
  --gold-soft: #e9d9b2;
  --free-bg: #fffcf5;
  --free-line: #cbbfa3;
  --reserved: #c98f24;
  --reserved-bg: #f6e4bb;
  --done: #4b7340;
  --done-bg: #dbe8d1;
  --danger: #9b3b2a;
  --whatsapp: #1f8f4e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(38, 56, 31, .06), 0 6px 18px rgba(38, 56, 31, .07);
  --font-body: "IBM Plex Sans Arabic", "Noto Sans Arabic", Tahoma, sans-serif;
  --font-display: "Amiri", "Noto Naskh Arabic", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ══════════════ الشريط التجريبي ══════════════ */
.demo-banner {
  background: #fdf3d6; color: #6b4e10; text-align: center;
  font-size: 14px; padding: 8px 16px; border-bottom: 1px solid #ecd9a4;
}
.demo-banner button {
  background: none; border: 0; color: inherit; text-decoration: underline;
  cursor: pointer; font-size: 14px; padding: 0 4px;
}

/* ══════════════ رأس الصفحة: الإهداء ══════════════ */
.hero {
  position: relative;
  text-align: center;
  color: #f6efdc;
  padding: 40px 20px 44px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(168, 131, 58, .22), transparent 60%),
    linear-gradient(180deg, #2f4627 0%, var(--olive-deep) 100%);
  overflow: hidden;
}
.ornament {
  position: absolute; inset: 0; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23e9d9b2' stroke-width='1.2'%3E%3Cpath d='M32 6l7.5 18.1L58 32l-18.5 7.9L32 58l-7.5-18.1L6 32l18.5-7.9z'/%3E%3Crect x='19' y='19' width='26' height='26' transform='rotate(45 32 32)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 64px 64px;
  animation: drift 90s linear infinite;
}
@keyframes drift { to { background-position: 640px 320px; } }

/* ذرّات نور تصعد ببطء */
.motes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mote {
  position: absolute; bottom: -10px;
  width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle, rgba(241, 223, 174, .95), rgba(241, 223, 174, 0) 70%);
  animation: rise var(--d) linear infinite; animation-delay: var(--delay);
  opacity: 0;
}
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  15% { opacity: .9; }
  85% { opacity: .6; }
  100% { transform: translate(var(--x), -520px); opacity: 0; }
}
.hero > :not(.ornament):not(.motes) { position: relative; }
.portrait { margin: 0 auto 14px; position: relative; width: 148px; }
.portrait-frame {
  position: relative;
  width: 148px; height: 148px; border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28), 0 0 0 0 rgba(233, 217, 178, .35);
  display: grid; place-items: center;
  animation: halo 4s ease-in-out infinite;
}
/* حلقة ذهبية تدور ببطء حول الصورة */
.portrait-frame::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 200deg, #c9a75d, #f1dfae, #a8833a, #e9d9b2, #c9a75d);
  animation: spin 14s linear infinite;
}
.portrait-frame > * { position: relative; z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes halo {
  0%, 100% { box-shadow: 0 10px 30px rgba(0, 0, 0, .28), 0 0 0 0 rgba(233, 217, 178, .0); }
  50% { box-shadow: 0 10px 30px rgba(0, 0, 0, .28), 0 0 34px 6px rgba(233, 217, 178, .22); }
}
.portrait-frame img,
.portrait-fallback {
  width: 138px; height: 138px; border-radius: 50%;
  border: 4px solid var(--olive-deep);
  object-fit: cover; object-position: center 20%; display: block;
}
.portrait-fallback {
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #3e5935, #22331c);
  font-family: var(--font-display); font-size: 64px; color: var(--gold-soft);
}
.honorific { margin: 0; font-size: 16px; color: var(--gold-soft); letter-spacing: .02em; }
.name {
  margin: 2px 0 6px;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 9vw, 48px); line-height: 1.25;
}
.dates { margin: 0 0 18px; font-size: 15px; color: #d9d2bc; }
.dua {
  max-width: 560px; margin: 0 auto;
  font-family: var(--font-display); font-size: 19px; line-height: 1.9;
  color: #efe6cd;
  padding-top: 16px; border-top: 1px solid rgba(233, 217, 178, .25);
}

/* ══════════════ الحاوية ══════════════ */
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 32px; }

/* ══════════════ التخطيط المتجاوب ══════════════ */
/* الجوال: عمود واحد بترتيب مقصود */
.layout { display: flex; flex-direction: column; }
.col-main, .col-side { display: contents; }
.layout #goal { order: 1; }
.layout .cta { order: 2; }
.layout #mine { order: 3; }
.layout .khatmas-sec { order: 4; }
.layout .share { order: 5; }

/* الشاشات العريضة: عمودان، والجانبي ثابت أثناء التمرير */
@media (min-width: 980px) {
  .wrap { max-width: 1120px; padding: 0 24px 40px; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
  .col-main, .col-side { display: block; }
  .col-side { position: sticky; top: 20px; }
  .col-side .share { margin-top: 8px; }
  .hero { padding: 56px 20px 64px; }
  .name { font-size: 56px; }
  .portrait, .portrait-frame { width: 176px; }
  .portrait-frame { height: 176px; }
  .portrait-frame img, .portrait-fallback { width: 166px !important; height: 166px !important; }
}

/* ظهور تدريجي للأقسام */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
.section-title {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  color: var(--olive-deep); margin: 36px 0 14px;
}

/* ══════════════ الإحصائيات ══════════════ */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-top: -26px; position: relative;
}
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 10px; text-align: center;
  display: flex; flex-direction: column; justify-content: center;
}
.stat-num { font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--olive); font-variant-numeric: tabular-nums; }
.stat-main .stat-num { font-size: 40px; color: var(--gold); }
.stat-label { font-size: 13px; color: var(--muted); line-height: 1.4; margin-top: 4px; }

/* ══════════════ الأزرار ══════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px; border-radius: 14px;
  border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 17px;
  text-decoration: none; transition: transform .08s ease, background .15s ease, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-primary { background: var(--olive); color: #fff; box-shadow: 0 4px 14px rgba(63, 90, 54, .3); }
.btn-primary:hover { background: var(--olive-deep); }
.btn-ghost { background: transparent; color: var(--olive-deep); border-color: var(--line); }
.btn-ghost:hover { background: #f0e9d9; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #e7cfc7; }
.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-facebook { background: #1877f2; color: #fff; }
.btn-instagram { background: linear-gradient(45deg, #f09433, #dc2743 55%, #bc1888); color: #fff; }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 15px; border-radius: 12px; }
.btn-xl { width: 100%; min-height: 64px; font-size: 22px; border-radius: 18px; }

.cta { margin-top: 24px; text-align: center; }

/* لمعة تمر على الزر الرئيسي كل بضع ثوانٍ */
.btn-shine { position: relative; overflow: hidden; isolation: isolate; }
.btn-shine::after {
  content: ""; position: absolute; inset: -40% auto -40% -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg); animation: shine 4.5s ease-in-out infinite; z-index: -1;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.btn-shine:not([disabled]) { animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 4px 14px rgba(63, 90, 54, .30); }
  50% { box-shadow: 0 6px 26px rgba(63, 90, 54, .48); }
}
.cta-hint { margin: 10px 0 0; font-size: 15px; color: var(--muted); }

/* ══════════════ أجزائي ══════════════ */
.mine-list { display: grid; gap: 12px; }
.mine-card {
  background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--reserved);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.mine-card.expired { border-inline-start-color: var(--danger); }
.mine-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mine-juz { font-size: 22px; font-weight: 700; color: var(--ink); }
.mine-meta { font-size: 14px; color: var(--muted); }
.mine-warn { color: var(--danger); font-size: 14px; margin: 6px 0 0; }
.mine-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.mine-actions .btn { flex: 1 1 auto; }

/* ══════════════ بطاقات الختمات ══════════════ */
.khatmas { display: grid; gap: 14px; }
.loading, .empty { color: var(--muted); text-align: center; padding: 24px 0; }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.kcard.near { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(168, 131, 58, .15), var(--shadow); }
.khead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ktitle { font-size: 19px; font-weight: 700; margin: 0; }
.badge {
  font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--gold-soft); color: #6e5216;
}
.bar {
  display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px;
  margin: 12px 0 8px; height: 12px;
}
.bar i { border-radius: 3px; background: #e9e1cf; }
.bar i.r { background: var(--reserved); }
.bar i.d { background: var(--done); }
.kcounts { font-size: 14px; color: var(--muted); margin: 0; }
.kcounts b { color: var(--ink); font-weight: 600; }
.ktoggle {
  margin-top: 10px; width: 100%; background: none; border: 1px dashed var(--line);
  border-radius: 12px; min-height: 44px; color: var(--olive-deep); cursor: pointer; font-weight: 600; font-size: 15px;
}
.ktoggle:hover { background: #f6f0e2; }

.grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px;
}
.cell {
  aspect-ratio: 1 / 1; min-height: 52px;
  border-radius: 12px; border: 1.5px solid var(--free-line); background: var(--free-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; font-weight: 700; font-size: 19px; color: var(--ink); padding: 0;
  position: relative;
}
.cell small { font-size: 11px; font-weight: 500; color: var(--muted); line-height: 1.2; }
.cell.free:hover { border-color: var(--olive); background: #f3f6ef; }
.cell.expired { border-style: dashed; }
.cell.reserved { background: var(--reserved-bg); border-color: #e3c27d; }
.cell.reserved small { color: #7a5612; }
.cell.done { background: var(--done-bg); border-color: #b5cda8; color: var(--done); }
.cell.done small { color: var(--done); }
.cell.mine { box-shadow: inset 0 0 0 2px var(--reserved); }

.legend {
  list-style: none; padding: 0; margin: 14px 0 0;
  display: flex; gap: 18px; justify-content: center; font-size: 14px; color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1.5px solid var(--free-line); background: var(--free-bg); }
.sw-reserved { background: var(--reserved); border-color: var(--reserved); }
.sw-done { background: var(--done); border-color: var(--done); }

/* ══════════════ المشاركة والتذييل ══════════════ */
.share p { margin: 0 0 12px; color: var(--muted); }
.btn-story {
  background: linear-gradient(45deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888);
  color: #fff; position: relative; gap: 12px;
}
.btn-story.btn-xl { font-size: 21px; }
.story-ring {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  border: 3px solid #fff; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .35);
  animation: ring-pulse 2.4s ease-in-out infinite;
}
@keyframes ring-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.story-platforms { text-align: center; font-size: 13px; margin: 8px 0 14px !important; }
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.share-actions .btn { flex: 1 1 140px; }
.footer {
  text-align: center; padding: 28px 16px 40px; color: var(--muted); font-size: 15px;
  border-top: 1px solid var(--line); margin-top: 24px;
}
.footer p { margin: 4px 0; }
.footer-small { font-size: 13px; }

/* ══════════════ النافذة السفلية ══════════════ */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px;
  background: var(--surface); color: var(--ink);
  border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
}
.sheet::backdrop { background: rgba(20, 28, 17, .45); }
.sheet[open] { animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-body { padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet-handle { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-title { font-family: var(--font-display); font-size: 26px; margin: 0 0 4px; color: var(--olive-deep); }
.sheet-text { margin: 0 0 14px; color: var(--muted); }
.field { display: grid; gap: 6px; margin-bottom: 16px; font-size: 15px; color: var(--muted); }
.field input {
  min-height: 52px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px;
  background: #fff; color: var(--ink); font-size: 18px;
}
.field input:focus { border-color: var(--olive); outline: none; }
.sheet-actions { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 22px; }
}

/* ══════════════ الإشعار ══════════════ */
.toast {
  position: fixed; inset-inline: 16px; bottom: calc(18px + env(safe-area-inset-bottom));
  margin: 0 auto; max-width: 520px;
  background: var(--olive-deep); color: #fff; border-radius: 14px; padding: 14px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 16px; text-align: center;
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #6d2c20; }

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .grid { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.admin-details { margin-top: 12px; font-size: 14px; text-align: start; display: inline-block; max-width: 100%; }
.admin-details summary { cursor: pointer; color: var(--olive-deep); text-align: center; }
.admin-details p {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin: 8px 0 0; color: var(--ink); direction: rtl; overflow-wrap: anywhere;
}

/* ══════════════ هدف الأربعين ══════════════ */
.goal {
  margin-top: 16px; padding: 16px 18px;
  background: linear-gradient(135deg, #fffcf5, #f7efdb);
  border: 1px solid var(--gold-soft); border-radius: var(--radius); box-shadow: var(--shadow);
}
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.goal-title { margin: 0; font-family: var(--font-display); font-size: 22px; color: var(--olive-deep); }
.goal-days {
  font-size: 14px; font-weight: 600; color: #6e5216;
  background: var(--gold-soft); padding: 3px 12px; border-radius: 999px;
}
.goal-track {
  height: 14px; border-radius: 999px; background: #e9e1cf; overflow: hidden; margin: 12px 0 8px;
}
.goal-fill {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #d9b866);
  transition: width .8s ease;
}
.goal-meta { margin: 0; font-size: 15px; color: var(--muted); }
.goal-meta b { color: var(--ink); }
.goal.reached { border-color: var(--done); }
.goal.reached .goal-fill { background: linear-gradient(90deg, var(--done), #6f9a5f); }

/* ══════════════ الاسم الإجباري وبطاقة المشاركة ══════════════ */
.field-hint { font-size: 13px; color: var(--muted); }
.field input:user-invalid { border-color: var(--danger); }
.btn-block { width: 100%; margin-top: 10px; }
.sheet-actions .btn-instagram, .sheet-actions #card-download { min-height: 52px; }
.card-preview-wrap {
  position: relative; display: grid; place-items: center;
  background: #1d2b18; border-radius: 16px; margin-bottom: 14px; min-height: 200px; overflow: hidden;
}
.card-preview { display: block; width: auto; max-width: 100%; max-height: 46vh; aspect-ratio: 9 / 16; }
.card-loading { position: absolute; color: var(--gold-soft); margin: 0; font-size: 15px; }
.mine-actions .btn-card { flex: 0 0 auto; }
.sheet { max-height: 96vh; overflow-y: auto; }


/* ══════════════ شريط "مباشر" المتحرك ══════════════ */
.ticker {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  display: flex; align-items: stretch; height: 50px;
  padding-bottom: env(safe-area-inset-bottom);
  background: linear-gradient(180deg, #2c4026, #1f2e1a);
  color: #f6efdc; box-shadow: 0 -6px 20px rgba(0, 0, 0, .18);
  border-top: 1px solid rgba(233, 217, 178, .25);
}
.ticker-label {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px;
  background: var(--gold); color: #1f2e1a; font-weight: 700; font-size: 15px;
  position: relative; z-index: 1;
}
.ticker-label::after { /* طرف مدبب للملصق */
  content: ""; position: absolute; inset-inline-end: -10px; top: 50%; translate: 0 -50%;
  border: 10px solid transparent; border-inline-start-color: var(--gold); border-inline-end: 0;
}
.ticker-viewport {
  flex: 1; overflow: hidden; direction: ltr; position: relative;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker-track {
  display: flex; width: max-content; height: 100%;
  animation: tk var(--dur, 40s) linear infinite;
}
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
@keyframes tk { from { transform: translateX(-50%); } to { transform: translateX(0); } }
.tk-group { display: flex; align-items: center; min-width: 100vw; justify-content: flex-end; }
.tk-item {
  direction: rtl; unicode-bidi: isolate; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; padding: 0 6px; font-size: 15px;
}
.tk-item b { color: #fff; }
.tk-ico {
  min-width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 700; padding: 0 4px;
  background: rgba(233, 217, 178, .2); color: var(--gold-soft);
}
.tk-item.done .tk-ico { background: #4b7340; color: #fff; }
.tk-time { color: #bfb79c; font-size: 13px; }
.tk-sep { color: var(--gold); padding: 0 14px; font-size: 12px; }
.ticker.flash .ticker-label { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { background: #fff3cf; } 100% { background: var(--gold); } }

body.has-ticker { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
body.has-ticker .toast { bottom: calc(68px + env(safe-area-inset-bottom)); }

/* ══════════════ حيوية التفاصيل ══════════════ */
.stat-num.bump { animation: bump .6s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); color: var(--gold); } }

.goal-fill { position: relative; overflow: hidden; }
.goal-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .45) 50%, transparent 80%);
  transform: translateX(-100%); animation: sweep 3s ease-in-out infinite;
}
@keyframes sweep { to { transform: translateX(100%); } }

.cell { transition: transform .15s ease, box-shadow .15s ease, background .3s; }
.cell.pop, .bar i.pop { animation: pop .9s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop {
  0% { transform: scale(.6); }
  40% { transform: scale(1.18); box-shadow: 0 0 0 6px rgba(201, 167, 93, .35); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(201, 167, 93, 0); }
}
@media (hover: hover) {
  .cell.free:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(38, 56, 31, .12); }
  .kcard, .stat, .mine-card { transition: transform .2s ease, box-shadow .2s ease; }
  .kcard:hover, .stat:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(38, 56, 31, .06), 0 12px 28px rgba(38, 56, 31, .10); }
}
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(10, 1fr); }
  .cell { min-height: 48px; font-size: 17px; }
}

.mine-time { height: 6px; border-radius: 3px; background: #efe6d2; margin-top: 10px; overflow: hidden; }
.mine-time i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--reserved), #e2b35a); }

.celebrate { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 100; }

/* ══════════════ نافذة القصص ══════════════ */
.sheet-wide { max-width: 760px; }
.sheet-wide .sheet-title { font-size: 24px; }
.sheet-wide .sheet-text { font-size: 15px; margin-bottom: 12px; }
/* المعاينة صغيرة بجانب الخطوات، كي يبقى زر المشاركة ظاهراً دون تمرير */
.story-layout { display: grid; grid-template-columns: 108px 1fr; gap: 12px; align-items: start; }
.story-layout .card-preview-wrap { margin-bottom: 0; min-height: 0; border-radius: 12px; }
.story-layout .card-preview { width: 100%; max-height: none; }
.story-layout .card-loading { font-size: 12px; padding: 40px 6px; position: static; text-align: center; }
/* أزرار المشاركة ثابتة أسفل النافذة */
.sheet-wide .sheet-actions {
  position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); z-index: 2;
  background: var(--surface); padding: 10px 0 4px; margin-top: 4px;
}
.story-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.story-steps li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.55; }
.step-n {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); color: #fff; font-weight: 700; font-size: 14px;
}
.story-steps em { color: var(--done); font-style: normal; font-weight: 600; }
.prompt-chip {
  display: inline-block; margin-top: 6px; padding: 5px 10px; border-radius: 999px;
  border: 1.5px dashed #dc2743; background: #fff4f6; color: #9b1c3a;
  font-size: 13px; font-weight: 600; cursor: pointer; text-align: start;
}
.story-note {
  font-size: 12.5px; color: var(--muted); background: #f6f0e2; border-radius: 12px;
  padding: 8px 12px; margin: 12px 0 6px; line-height: 1.65;
}
@media (min-width: 640px) {
  .story-layout { grid-template-columns: 220px 1fr; gap: 18px; align-items: center; }
  .story-steps { font-size: 15px; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-viewport { overflow-x: auto; }
  .reveal { opacity: 1; transform: none; }
}
.sheet-wide .sheet-actions { grid-template-columns: 1.6fr 1fr; }
.sheet-wide .sheet-actions .btn { white-space: nowrap; padding-inline: 12px; }

/* ══════════════ نافذة القصة المتحركة ══════════════ */
.story-layout { grid-template-columns: 132px 1fr; align-items: center; }
.story-actions { display: grid; gap: 8px; }
.btn-block-lg { width: 100%; min-height: 56px; font-size: 17px; }
.story-targets { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.story-hint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; text-align: center; }
.story-actions #card-download { justify-self: center; min-height: 40px; }
.card-progress {
  position: absolute; inset-inline: 10px; bottom: 10px; height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, .2); overflow: hidden; z-index: 2;
}
.card-progress i { display: block; height: 100%; width: 0; background: var(--gold-soft); transition: width .25s linear; }
.btn-story[disabled] { filter: grayscale(.35); }
@media (min-width: 640px) {
  .story-layout { grid-template-columns: 230px 1fr; }
}
