/* «العدّاد» — the glass countdown popup (src/countdown.js).
   Lives in its own file so the main stylesheet stays untouched; the page
   loads it next to style.css and it reuses the site's tokens. */

.cdpop {
  --dir: 1;                       /* the off-screen side: flipped in RTL below */
  position: fixed; z-index: 60;
  inset-block-end: 24px; inset-inline-end: 24px;
  width: min(340px, calc(100vw - 32px));
  border-radius: 24px; padding: 18px 18px 16px;
  color: var(--text); font-family: var(--body);
  /* Glass: a frosted pane over the night sky, lit gold from the top corner. */
  background:
    linear-gradient(150deg, rgba(234, 184, 95, .16), rgba(255, 255, 255, .03) 42%),
    rgba(18, 34, 64, .55);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 -1px 0 rgba(255, 255, 255, .06),
    0 24px 60px rgba(0, 0, 0, .5),
    0 0 50px rgba(234, 184, 95, .12);
  opacity: 0; visibility: hidden;
  transform: translateX(calc(130% * var(--dir))) scale(.96);
  transition: transform .62s cubic-bezier(.16, 1.1, .3, 1), opacity .4s ease, visibility .62s;
}
[dir="rtl"] .cdpop { --dir: -1; }
.cdpop.in { opacity: 1; visibility: visible; transform: translateX(0) scale(1); }
.cdpop.out { opacity: 0; transform: translateX(calc(130% * var(--dir))) scale(.96); }

/* The little hop when the popup swaps to the next game. */
.cdpop.hop { animation: cdhop .55s var(--ease); }
@keyframes cdhop {
  0% { transform: translateX(0) scale(1); }
  35% { transform: translateX(calc(-8px * var(--dir))) scale(1.03); }
  70% { transform: translateX(calc(3px * var(--dir))) scale(.995); }
  100% { transform: translateX(0) scale(1); }
}

.cdpop-x {
  position: absolute; inset-block-start: 10px; inset-inline-end: 10px;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .08); color: var(--muted);
  transition: background .2s, color .2s, transform .2s;
}
.cdpop-x svg { width: 15px; height: 15px; }
.cdpop-x:hover { background: rgba(255, 255, 255, .16); color: var(--text); transform: rotate(90deg); }

.cdpop-body { display: grid; gap: 14px; }
.cdpop-head { display: flex; align-items: center; gap: 12px; padding-inline-end: 26px; }
.cdpop-icon { position: relative; flex: none; }
.cdpop-icon img {
  width: 54px; height: 54px; border-radius: 16px; object-fit: cover;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .12);
}
.cdpop-name { display: grid; gap: 2px; min-width: 0; }
.cdpop-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--gold); font-size: .74rem; font-weight: 600; letter-spacing: .02em;
}
.cdpop-eyebrow::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); animation: ping 2.4s infinite;
}
.cdpop-title {
  font-family: var(--display); font-weight: 700; font-size: 1.04rem; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.cdpop-clock {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  direction: ltr; padding: 10px 8px; border-radius: 16px;
  background: rgba(7, 15, 31, .42); border: 1px solid rgba(255, 255, 255, .08);
}
.cdpop-clock em { color: var(--faint); font-style: normal; font-weight: 700; transform: translateY(-6px); }
.cdpop-cell { display: grid; justify-items: center; gap: 2px; min-width: 52px; }
.cdpop-cell b {
  font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff3d6, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cdpop-cell i { font-style: normal; color: var(--faint); font-size: .68rem; }
.cdpop-wait { width: 100%; text-align: center; color: var(--gold-2); font-weight: 600; font-size: .92rem; direction: initial; }
/* The stage in words under a running clock: «اترفعت للمتاجر — في انتظار
   المراجعة» and the like, so the numbers are never the whole story. */
.cdpop-stage {
  margin: 0; text-align: center; font-size: .8rem; line-height: 1.5;
  color: var(--gold-2); font-weight: 600;
}
.cdpop-stage[hidden] { display: none; }

.cdpop-acts { display: flex; gap: 8px; }
.cdpop-btn {
  flex: 1; text-align: center; padding: 10px 12px; border-radius: 12px;
  font-size: .86rem; font-weight: 600; transition: transform .2s var(--ease), background .2s, box-shadow .2s;
}
.cdpop-btn.gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #1c1407; box-shadow: 0 10px 24px rgba(234, 184, 95, .26); }
.cdpop-btn.ghost { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); color: var(--text); flex: 0 0 auto; }
.cdpop-btn:hover { transform: translateY(-2px); }
.cdpop-btn.gold:hover { box-shadow: 0 14px 30px rgba(234, 184, 95, .36); }
.cdpop-btn.ghost:hover { background: rgba(255, 255, 255, .12); }

.cdpop-dots { display: flex; justify-content: center; gap: 6px; }
.cdpop-dots:empty { display: none; }
.cdpop-dots button {
  width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .2); transition: background .25s, width .25s;
}
.cdpop-dots button[aria-selected="true"] { width: 18px; border-radius: 4px; background: var(--gold); }

/* Phones: a bar at the bottom that slides up instead of in from the side. */
@media (max-width: 560px) {
  .cdpop {
    inset-inline: 12px; inset-block-end: 12px; width: auto;
    padding: 14px 14px 12px; border-radius: 20px;
    transform: translateY(130%) scale(.98);
  }
  .cdpop.in { transform: translateY(0) scale(1); }
  .cdpop.out { transform: translateY(130%) scale(.98); }
  .cdpop.hop { animation: none; }
  .cdpop-cell b { font-size: 1.32rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cdpop { transition: opacity .3s ease, visibility .3s; transform: none !important; }
  .cdpop.hop { animation: none; }
  .cdpop-eyebrow::before { animation: none; }
}
