/* =========================================================
   هود — نظام التصميم
   ورق كريمي · نبيذي · لمسة ذهبية · روح أوراق اللعب
   الخطوط: Aref Ruqaa (العناوين والأرقام) · Tajawal (النصوص)
   ========================================================= */

:root {
  --paper: #f3ebdb;
  --paper-2: #e9dcc3;
  --card: #fbf7ee;
  --ink: #1d1412;
  --ink-2: rgba(29, 20, 18, .66);
  --ink-3: rgba(29, 20, 18, .4);
  --line: rgba(29, 20, 18, .14);
  --wine: #6e1022;
  --wine-2: #8c1a30;
  --wine-deep: #4a0b18;
  --red: #c3202e;
  --gold: #a9834a;
  --ok: #2f6b4f;
  --fg: var(--ink);
  --fg-2: var(--ink-2);
  --logo-tint: var(--wine-deep);

  --hand: 'Aref Ruqaa', 'Amiri', serif;
  --body: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-card: 20px;
  --r-ctl: 12px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 18px 40px -18px rgba(74, 11, 24, .45), 0 4px 12px rgba(29, 20, 18, .08);
  --shadow-lift: 0 10px 24px -10px rgba(74, 11, 24, .55);
  --ease: cubic-bezier(.3, .1, .2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #170a0d;
    --paper-2: #24100f;
    --fg: #f1e9d8;
    --fg-2: rgba(241, 233, 216, .7);
    --logo-tint: #e8c9b8;
    --shadow-card: 0 24px 50px -20px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #170a0d; --paper-2: #24100f; --fg: #f1e9d8; --fg-2: rgba(241, 233, 216, .7); --logo-tint: #e8c9b8; color-scheme: dark;
}

/* ---------- أساسيات ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 500 16px/1.7 var(--body);
  color: var(--fg);
  background:
    radial-gradient(120% 80% at 50% 0%, transparent 40%, rgba(74, 11, 24, .07) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .15 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
bdi { unicode-bidi: isolate; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 6px; }

.red { color: var(--red); }
.display { font-family: var(--hand); font-weight: 400; line-height: 1.45; letter-spacing: 0; }
.eyebrow { font: 700 13px/1.4 var(--body); letter-spacing: .02em; color: var(--gold); }
.lead { font-size: 16.5px; color: var(--fg-2); }
.hint { font-size: 15px; color: var(--ink-2); margin-bottom: 12px; }

.logo {
  display: block;
  background: var(--logo-tint);
  -webkit-mask: url("../img/logo.png") center / contain no-repeat;
  mask: url("../img/logo.png") center / contain no-repeat;
}

/* ---------- المشاهد ---------- */
.scene {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto; overscroll-behavior: contain;
  transition: opacity 1s ease, visibility 0s;
}
.scene.off { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .9s ease, visibility 0s .9s; }
.scene::before, .scene::after { content: ''; flex: 1 1 0; min-height: 0; } /* توسيط آمن لا يقصّ المحتوى الطويل */
.scene > .sheet { flex: none; }

.corner-tap { position: fixed; top: 0; left: 0; width: 64px; height: 64px; z-index: 60; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 12px 28px;
  font: 700 16.5px/1 var(--body); color: #fbf7ee; text-decoration: none;
  background: linear-gradient(180deg, var(--wine-2), var(--wine));
  border-radius: 999px;
  box-shadow: var(--shadow-lift), inset 0 1px 0 rgba(255, 255, 255, .15);
  transition: transform .25s var(--ease), box-shadow .25s, opacity .25s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .35; box-shadow: none; cursor: default; transform: none; }
.btn-lg { min-height: 56px; padding-inline: 34px; font-size: 18px; }
.btn-sm { min-height: 44px; padding: 10px 18px; font-size: 15px; }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.link { font: 500 14.5px var(--body); color: var(--ink-2); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--ink-3); padding: 6px; }

/* ---------- المقدمة ---------- */
#intro { overflow: hidden; }
.orb { position: relative; width: min(78vw, 320px); aspect-ratio: 1; animation: fade-in 1.4s ease both; }
.ring { position: absolute; inset: 0; }
.slot { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.suit {
  /* left/top صريحة: في الصفحات العربية (RTL) يُحسب الموضع من اليمين فتنزاح الأشكال لليسار */
  position: absolute; left: 0; top: 0; translate: -50% -50%;
  display: grid; place-items: center; width: 48px; height: 48px;
  font: 400 44px/1 Georgia, 'Times New Roman', serif; color: var(--fg);
}
.suit.red { color: var(--red); }
/* كل الأشكال بنفس الحجم أثناء الدوران */
.suit svg { display: block; width: 40px; height: 40px; fill: currentColor; }
.suit.logo { background: var(--logo-tint); width: 38px; height: 44px; }
.skip {
  position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); left: 0; right: 0; margin-inline: auto; width: max-content;
  font: 500 14px var(--body); color: var(--fg-2); padding: 10px 18px; border-radius: 999px;
  opacity: 0; animation: fade-in .6s 1.6s ease forwards;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- الدعوة ---------- */
#invite { gap: 28px; text-align: center; }
.deal { display: flex; justify-content: center; direction: ltr; perspective: 900px; height: min(56vw, 250px); }
.deal-card {
  width: min(34vw, 150px); border-radius: 9px; margin: 0 -10px;
  box-shadow: 0 18px 30px -12px rgba(29, 20, 18, .45), 0 2px 6px rgba(29, 20, 18, .15);
  transform-origin: 50% 110%;
  opacity: 0; transform: translateY(40px) rotate(0);
  transition: transform 1.6s var(--ease), opacity 1s ease;
}
.deal-card.l { transform: translateX(30px) translateY(40px); }
.deal-card.r { transform: translateX(-30px) translateY(40px); z-index: 1; }
.play .deal-card { opacity: 1; }
.play .deal-card.l { transform: translateX(0) rotate(-9deg); }
.play .deal-card.r { transform: translateX(0) rotate(9deg); transition-delay: .12s; }

.invite-copy { max-width: 360px; display: grid; gap: 8px; justify-items: center; }
.invite-copy h1 { font-size: clamp(34px, 10vw, 46px); color: var(--fg); }
.invite-copy .lead { margin-bottom: 14px; }
.reveal { opacity: 0; transform: translateY(10px); transition: opacity .9s ease, transform .9s var(--ease); transition-delay: calc(.9s + var(--d) * .35s); }
.play .reveal { opacity: 1; transform: none; }

/* ---------- الورقة (بطاقة لعب) ---------- */
.sheet {
  position: relative;
  width: 100%; max-width: 440px;
  padding: 46px 24px 30px;
  color: var(--ink); text-align: center;
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
}
.sheet::before { /* الإطار الداخلي */
  content: ''; position: absolute; inset: 10px; pointer-events: none;
  border: 1px solid rgba(110, 16, 34, .16); border-radius: calc(var(--r-card) - 8px);
}
.sheet .link { align-self: center; margin-top: 6px; }
.pip {
  position: absolute; display: grid; justify-items: center;
  font: 700 15px/1.05 Georgia, 'Times New Roman', serif; color: var(--red); direction: ltr;
}
.pip i { font-style: normal; font-size: 14px; }
.pip-a { top: 18px; right: 20px; }
.pip-b { bottom: 18px; left: 20px; rotate: 180deg; }

.sheet-head { display: grid; justify-items: center; gap: 2px; margin-bottom: 8px; }
.sheet-logo { width: 38px; height: 44px; margin-bottom: 4px; --logo-tint: var(--wine); background: var(--wine); }
.sheet-head h1, .sheet-head h2 { font-size: clamp(28px, 8vw, 34px); color: var(--wine); }
.sheet-head .lead { color: var(--ink-2); max-width: 320px; }
.sheet-head .lead b { color: var(--ink); }
.sheet-head .hint { margin: 0; }

/* ---------- مؤشر المراحل ---------- */
.steps { list-style: none; display: flex; justify-content: center; gap: 6px; margin: 4px 0 18px; }
.steps li {
  display: grid; justify-items: center; gap: 2px; width: 72px;
  font: 400 20px/1 Georgia, serif; color: var(--ink);
  opacity: .28; transition: opacity .5s;
  position: relative;
}
.steps li small { font: 500 12px var(--body); color: var(--ink-2); }
.steps li.on, .steps li.done { opacity: 1; }
.steps li + li::before {
  content: ''; position: absolute; top: 10px; inset-inline-end: calc(100% - 14px); width: 28px; height: 1px; background: var(--ink-3);
}

/* ---------- لوحات الخطوات ---------- */
.panel { display: none; }
.panel.on { display: block; animation: panel-in .6s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }

.days { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 12px; }
.day-card {
  position: relative; aspect-ratio: 2 / 2.7;
  display: grid; align-content: center; justify-items: center; gap: 0;
  color: var(--ink); background: #fffdf8;
  border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--line), 0 2px 6px rgba(29, 20, 18, .05);
  transition: transform .35s var(--ease), box-shadow .35s, background .35s, color .35s;
}
.day-card b { font: 700 40px/1.1 var(--hand); }
.day-card span { font-size: 14.5px; }
.day-card small { font-size: 12.5px; color: var(--ink-2); }
.day-suit { position: absolute; top: 8px; right: 10px; font: 16px/1 Georgia, serif; }
.day-card:not([disabled]):hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1.5px var(--ink-3), var(--shadow-lift); }
.day-card[aria-pressed="true"] { background: var(--wine); color: #fbf7ee; box-shadow: var(--shadow-lift); transform: translateY(-3px) rotate(-2deg); }
.day-card[aria-pressed="true"] small, .day-card[aria-pressed="true"] .day-suit { color: rgba(251, 247, 238, .8); }
.day-card[disabled] { opacity: .45; cursor: not-allowed; }

.times { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.time {
  display: grid; gap: 0; padding: 12px 4px; min-height: 64px; border-radius: var(--r-ctl);
  font: 700 17px/1.4 var(--body); color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: background .3s, color .3s, box-shadow .3s, transform .3s var(--ease);
}
.time small { font: 500 12px var(--body); color: var(--ok); }
.time.low small { color: var(--red); }
.time:not([disabled]):hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); transform: translateY(-1px); }
.time[aria-pressed="true"] { background: var(--wine); color: #fbf7ee; box-shadow: var(--shadow-lift); }
.time[aria-pressed="true"] small { color: rgba(251, 247, 238, .8); }
.time[disabled] { opacity: .4; cursor: not-allowed; }
.time[disabled] small { color: var(--ink-2); }

/* ---------- الحقول ---------- */
.field { position: relative; display: block; margin: 8px 0 14px; text-align: start; }
.field input {
  width: 100%; padding: 22px 2px 8px;
  font: 500 17px var(--body); color: var(--ink);
  background: transparent; border: 0; border-bottom: 1.5px solid var(--ink-3); border-radius: 0;
  transition: border-color .3s;
}
.field input[dir="ltr"] { text-align: right; }
.field input:focus { outline: none; border-color: var(--wine); }
.field span {
  position: absolute; inset-inline-start: 2px; top: 20px;
  font-size: 16px; color: var(--ink-2); pointer-events: none;
  transform-origin: right top; transition: transform .25s var(--ease), color .25s;
}
.field input:focus + span, .field input:not(:placeholder-shown) + span { transform: translateY(-18px) scale(.8); color: var(--wine); }

.switch { display: flex; align-items: center; gap: 12px; margin: 14px 0 8px; cursor: pointer; text-align: start; font-size: 16px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { flex: none; position: relative; width: 46px; height: 28px; border-radius: 99px; background: var(--ink-3); transition: background .3s; }
.switch-ui::after { content: ''; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .3s var(--ease); }
.switch input:checked + .switch-ui { background: var(--wine); }
.switch input:checked + .switch-ui::after { transform: translateX(-18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--red); outline-offset: 2px; }

.summary {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px;
  margin-top: 16px; padding: 10px 12px; border-radius: var(--r-ctl);
  background: rgba(110, 16, 34, .06); font-size: 15px;
}
.summary > span:first-child { color: var(--red); }
.summary .link { padding: 0 4px; font-size: 14px; }

.err { min-height: 24px; margin-top: 6px; font: 500 14.5px var(--body); color: var(--red); }
.nav { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.nav .btn { min-width: 130px; }

/* ---------- لوحة البطاقتين ---------- */
.duo { display: flex; justify-content: center; direction: ltr; margin: 4px auto 10px; width: min(100%, 330px); }
.duo img { width: 54%; flex: none; filter: drop-shadow(0 8px 12px rgba(29, 20, 18, .18)); }
.duo img:first-child { margin-right: -8%; rotate: -7deg; transform-origin: 50% 100%; }
.duo img:last-child { rotate: 7deg; transform-origin: 50% 100%; }
.play .duo img, #done:not(.off) .duo img { animation: duo-in 1.1s var(--ease) both; }
.play .duo img:last-child, #done:not(.off) .duo img:last-child { animation-delay: .12s; }
@keyframes duo-in { from { opacity: 0; translate: 0 18px; } }

/* ---------- التذكرة ---------- */
.ticket {
  --notch: 14px;
  position: relative; margin: 8px 0 6px; text-align: center;
  background: #fffdf8; border-radius: 16px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  overflow: hidden;
}
.ticket-main { padding: 20px 18px 18px; display: grid; justify-items: center; gap: 2px; }
.ticket-eyebrow { font: 700 12px var(--body); color: var(--gold); letter-spacing: .03em; }
.ticket-name { font: 700 24px/1.4 var(--hand); color: var(--wine); }
.ticket-with { font-size: 14.5px; color: var(--ink-2); margin-top: -2px; }
.ticket-meta { display: grid; grid-template-columns: 1.6fr 1fr .8fr; width: 100%; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.ticket-meta div + div { border-inline-start: 1px solid var(--line); }
.ticket-meta dt { font-size: 12px; color: var(--ink-2); }
.ticket-meta dd { font: 700 15px/1.5 var(--body); color: var(--ink); }

.ticket-stub {
  position: relative; display: grid; justify-items: center; gap: 6px;
  padding: 22px 18px 18px;
  background: repeating-linear-gradient(90deg, var(--ink-3) 0 7px, transparent 7px 13px) top / 100% 1.5px no-repeat;
}
.ticket-stub::before, .ticket-stub::after { /* فتحات التخريم */
  content: ''; position: absolute; top: calc(var(--notch) * -1); width: calc(var(--notch) * 2); height: calc(var(--notch) * 2);
  border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line);
}
.ticket-stub::before { right: calc(var(--notch) * -1); }
.ticket-stub::after { left: calc(var(--notch) * -1); }
.qr { width: 156px; height: 156px; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.ticket-code { font: 700 15px/1 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .12em; color: var(--ink); }
.ticket-stub small { font-size: 13px; color: var(--ink-2); }

/* ---------- مشاركة دعوة الرفيق ---------- */
.share {
  display: grid; grid-template-columns: 78px 1fr; gap: 16px; align-items: center;
  margin: 14px 0 6px; padding: 16px; text-align: start;
  border-radius: 16px; background: linear-gradient(160deg, rgba(110, 16, 34, .07), rgba(169, 131, 74, .08));
  box-shadow: inset 0 0 0 1px rgba(110, 16, 34, .14);
}
.share-card { width: 78px; border-radius: 6px; rotate: 6deg; box-shadow: 0 8px 16px -6px rgba(29, 20, 18, .45); }
.share h3 { font: 400 22px/1.4 var(--hand); color: var(--wine); }
.share p { font-size: 14px; color: var(--ink-2); line-height: 1.6; margin-top: 2px; }
.share-btns { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-btns .btn:first-child { grid-column: 1 / -1; }
.share-btns .btn { padding-inline: 10px; }
.share > .link { grid-column: 1 / -1; justify-self: center; margin-top: -4px; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

/* ---------- المغلّف ---------- */
.envelope-stage { position: relative; width: min(86vw, 340px); height: 430px; perspective: 900px; }
.envelope { position: absolute; left: 3%; right: 3%; bottom: 0; aspect-ratio: 3 / 2; }
.envelope > div, .envelope > button { position: absolute; inset: 0; }
.env-back { background: var(--wine-deep); border-radius: 6px; z-index: 1; }
.env-front {
  z-index: 3; border-radius: 6px;
  background: linear-gradient(160deg, #9a2036, #7a1228);
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .55);
}
.env-flap {
  z-index: 4; background: linear-gradient(180deg, #7d1529, var(--wine));
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  transform-origin: 50% 0; transition: transform 1.4s var(--ease), z-index 0s .7s;
}
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.env-seal {
  inset: auto !important; left: 50% !important; top: 58% !important; width: 70px; height: 70px;
  translate: -50% -50%; border-radius: 50%; z-index: 5;
  background: radial-gradient(circle at 35% 30%, #a3243c, var(--wine-deep) 72%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .45), inset 0 0 0 3px rgba(255, 255, 255, .08), inset 0 0 0 7px rgba(0, 0, 0, .12);
  opacity: 0; scale: .6; transition: opacity .9s ease, scale 1s var(--ease);
}
.env-seal.on { opacity: 1; scale: 1; }
.env-seal .logo { position: absolute; left: 50%; top: 50%; width: 34px; height: 38px; translate: -50% -50%; background: #e7cfb9; }
.env-seal.pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 4px 10px rgba(0, 0, 0, .45), 0 0 0 0 rgba(195, 32, 46, .45); } 50% { box-shadow: 0 4px 10px rgba(0, 0, 0, .45), 0 0 0 14px rgba(195, 32, 46, 0); } }
.env-to {
  position: absolute; left: 0; right: 0; bottom: 5%;
  display: grid; justify-items: center; color: #f3dfcf;
}
.env-to small { font-size: 13px; opacity: .75; }
.env-to span { font: 700 clamp(22px, 6.5vw, 28px)/1.25 var(--hand); }
.env-to small { line-height: 1.2; }

.mini-card {
  position: absolute; left: 50%; top: 0; z-index: 2;
  width: 250px; min-height: 150px; margin-left: -125px; padding: 30px 18px 18px;
  display: grid; align-content: center; gap: 4px;
  text-align: center; color: var(--ink); background: var(--card);
  border-radius: 12px; box-shadow: 0 10px 24px rgba(0, 0, 0, .3);
}
.mini-card strong { font: 700 21px/1.4 var(--hand); color: var(--wine); }
.mini-card small { font-size: 14px; color: var(--ink-2); }
.pip-s { position: absolute; top: 8px; left: 12px; color: var(--red); font-size: 15px; }
.pip-s.b { top: auto; left: auto; bottom: 8px; right: 12px; rotate: 180deg; }

/* صفحة الرفيق: البطاقة تبدأ داخل المغلّف ثم ترتفع */
.envelope-stage.tall .mini-card { top: auto; bottom: 6%; transform: translateY(0); transition: transform 1.6s var(--ease); }
.envelope-stage.tall .mini-card.rise { transform: translateY(-235px); }

.seal-caption { margin-top: 18px; font: 500 16px var(--body); color: var(--fg); opacity: 0; transition: opacity 1s ease; text-align: center; }
.seal-caption.on { opacity: 1; }

/* ---------- إشعار ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 100;
  translate: -50% 20px; opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 999px;
  font: 500 15px var(--body); color: #fbf7ee; background: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3); transition: opacity .3s, translate .3s var(--ease);
}
.toast.on { opacity: 1; translate: -50% 0; }

/* ---------- شاشات صغيرة جدًا ---------- */
@media (max-width: 360px) {
  .sheet { padding-inline: 18px; }
  .times { grid-template-columns: repeat(2, 1fr); }
  .share { grid-template-columns: 1fr; }
  .share-card { display: none; }
}

/* ---------- الطباعة: التذكرة فقط ---------- */
@media print {
  body { background: #fff; overflow: visible; }
  .scene { position: static; }
  .scene.off, .actions, .share, .link, .corner-tap, .duo, .nav { display: none !important; }
  .sheet { box-shadow: none; }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}

/* ---------- الحجز باسم المدعو ---------- */
.who {
  display: grid; justify-items: center; gap: 0;
  margin: 2px 0 10px; padding: 12px; border-radius: var(--r-ctl);
  font-size: 15px; color: var(--ink-2);
  background: rgba(110, 16, 34, .06);
}
.who b { font: 700 22px/1.4 var(--hand); color: var(--wine); }
.who small { font-size: 12.5px; color: var(--ink-2); }

/* ---------- نافذة التأكيد ---------- */
.ask {
  margin: auto; width: min(360px, calc(100vw - 32px)); padding: 22px 22px 18px; border: 0; border-radius: 18px;
  color: var(--ink); background: var(--card); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5);
}
.ask::backdrop { background: rgba(23, 10, 13, .45); }
.ask[open] { animation: panel-in .25s var(--ease); }
.ask p { font-size: 16px; line-height: 1.7; margin-bottom: 18px; }
.ask-btns { display: flex; justify-content: flex-end; gap: 8px; }
.btn-danger { background: var(--red); }

/* ---------- شارك فرحتك (سوشل ميديا) ---------- */
.social {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 14px 0 0; padding: 16px; border-radius: 16px; text-align: start; color: #fbf7ee;
  background: linear-gradient(140deg, #7d1529, #3d0814);
  box-shadow: 0 14px 30px -16px rgba(74, 11, 24, .7);
}
.social h3 { font: 400 24px/1.3 var(--hand); }
.social p { font-size: 13.5px; opacity: .8; }
.social-btns { display: flex; gap: 8px; }
.social .btn { background: #fbf7ee; color: var(--wine); box-shadow: none; }
.social .btn-ghost { background: transparent; color: #fbf7ee; box-shadow: inset 0 0 0 1.5px rgba(251, 247, 238, .5); }
.fmt { display: inline-block; border: 2px solid currentColor; border-radius: 3px; }
.fmt.story { width: 10px; height: 17px; }
.fmt.post { width: 13px; height: 16px; }

.social-dlg {
  margin: auto; width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 16px;
  border: 0; border-radius: 22px; background: var(--card); color: var(--ink); overflow: auto;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .6);
}
.social-dlg::backdrop { background: rgba(23, 10, 13, .6); }
.social-preview { display: grid; place-items: center; margin-bottom: 14px; }
.social-preview img { width: auto; max-width: 100%; max-height: 62dvh; border-radius: 14px; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45); -webkit-touch-callout: default; }
.social-dlg-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.social-dlg-btns .btn { flex: 1 1 120px; }
.social-tip { margin-top: 10px; text-align: center; font-size: 12.5px; color: var(--ink-2); }

/* صفحة التذكرة أقصر */
#done .duo, #opened .duo { width: min(100%, 270px); margin-bottom: 4px; }

/* خط الرقعة مسافاته ضيقة بين الكلمات */
.display, .share h3, .social h3, .ticket-name, .mini-card strong { word-spacing: .14em; }

/* أيام كثيرة (الحجز العام): بطاقات أصغر */
.days.many { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.days.many .day-card { aspect-ratio: auto; padding: 10px 2px 8px; }
.days.many .day-card b { font-size: 28px; }
.days.many .day-card span { font-size: 12.5px; }
.days.many .day-card small { font-size: 11px; }
.days.many .day-suit { top: 5px; right: 6px; font-size: 12px; }

/* ---------- التذييل: ticket by Nakfeek Commercial (هادئ وصغير) ---------- */
.powered {
  display: inline-flex; align-items: center; gap: 6px; align-self: center; justify-self: center;
  margin: 14px auto 2px; padding: 0; background: none; box-shadow: none; flex: none;
  opacity: .45; transition: opacity .25s;
}
.powered:hover { opacity: .9; }
.powered-label { font: 500 10px var(--body); color: var(--fg-2); white-space: nowrap; }
.powered img { width: 52px; height: auto; display: block; filter: grayscale(1) contrast(1.2); }
/* على الخلفيات الداكنة: شعار فاتح */
body.hub .powered img { filter: brightness(0) invert(1); }
body.hub .powered-label { color: #f3e6d6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .scene > .powered img, :root:not([data-theme="light"]) form.lock + .powered img { filter: brightness(0) invert(1); }
}
:root[data-theme="dark"] .scene > .powered img { filter: brightness(0) invert(1); }
.scene > .powered { margin-top: 12px; }
body:not(.hub):not(.station):not(.dash):not(.admin) > .powered { display: flex; width: max-content; }
form.lock + .powered { display: flex; width: max-content; margin: 0 auto 20px; }
#dash > .powered, #app > .powered { display: flex; width: max-content; margin-top: 24px; }
form.lock[hidden] + .powered { display: none !important; }

/* ---------- عدد الأشخاص ---------- */
.party { margin-bottom: 14px; }
.party .hint { margin-bottom: 8px; }
.party-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 8px; }
.party-chip {
  display: grid; justify-items: center; gap: 0; padding: 8px 4px; border-radius: 12px;
  color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line);
  transition: background .2s, color .2s, box-shadow .2s;
}
.party-chip b { font: 700 24px/1.15 var(--hand); }
.party-chip small { font-size: 11.5px; color: var(--ink-2); }
.party-chip[aria-checked="true"] { color: #fbf7ee; background: var(--wine); box-shadow: var(--shadow-lift); }
.party-chip[aria-checked="true"] small { color: rgba(251, 247, 238, .85); }
.party-chip[disabled] { opacity: .35; cursor: not-allowed; }

/* زر واتساب الأساسي لإرسال دعوة الرفيق */
.btn-wa { grid-column: 1 / -1; background: linear-gradient(180deg, #2fbf5e, #1f9e4a); box-shadow: 0 10px 22px -10px rgba(31, 158, 74, .6); }
.btn-wa svg { flex: none; }

/* ---------- انقطاع الاتصال بالخادم ---------- */
.net-error {
  position: fixed; inset: auto 16px max(16px, env(safe-area-inset-bottom)); z-index: 300;
  display: grid; gap: 6px; justify-items: center; padding: 16px; border-radius: 16px; text-align: center;
  color: var(--ink); background: var(--card); box-shadow: 0 20px 40px -10px rgba(0, 0, 0, .45);
}
.net-error b { color: var(--red); }
.net-error span { font-size: 14px; color: var(--ink-2); }

/* ---------- دخول الفريق: الجوال ثم كلمة السر ---------- */
.lock-step { font-size: 15px; color: var(--ink-2); margin: -4px 0 4px; }
.lock-pane { width: 100%; animation: panel-in .35s var(--ease); }
.lock-who { display: flex; align-items: center; justify-content: center; gap: 10px; font: 700 16px var(--body); color: var(--ink); }
.lock-who .link { font-size: 13px; padding: 0; }
#lockHello { display: block; font: 500 14.5px/1.7 var(--body); color: var(--ink-2); text-align: center; }
.field-pass input { padding-left: 64px; }
.field-pass .eye { position: absolute; left: 0; bottom: 8px; padding: 4px 8px; font: 700 12.5px var(--body); color: var(--wine); }

/* ---------- الجنس: اختيار ذكر/أنثى ---------- */
.gender-seg { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; font-size: 14px; color: var(--ink-2); }
.gender-seg > span { min-width: 48px; }
.gender-seg label { position: relative; flex: 1; cursor: pointer; }
.gender-seg input { position: absolute; opacity: 0; inset: 0; }
.gender-seg label span { display: block; padding: 9px 4px; border-radius: 10px; text-align: center; font: 700 14.5px var(--body); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); transition: background .2s, color .2s; }
.gender-seg input:checked + span { color: #fbf7ee; background: var(--wine); box-shadow: none; }
.gender-seg input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 2px; }

/* بطاقة واحدة حسب الجنس */
.deal[data-only="m"] .deal-card.r, .deal[data-only="f"] .deal-card.l { display: none; }
.deal[data-only] .deal-card { margin: 0; transform: translateY(40px); }
.play .deal[data-only] .deal-card { transform: rotate(-3deg); }
.duo[data-only="m"] img:last-child, .duo[data-only="f"] img:first-child { display: none; }
.duo[data-only] img { rotate: 0deg !important; margin: 0 !important; width: 62%; }
