/* =====================================================================
   جولة 58 — العد التنازلي: أنابيب نيكسي متوهجة + فتيل يحترق + إنذار آخر دقيقة + «اختراق» عند الصفر
   ===================================================================== */
.cd-host { min-width: 0 }
.cd-host[hidden] { display: none }
.cdx { --cd: #ff5a1f; --cdd: .55; --mx: 0; --my: 0; --burn: 0;
  position: relative; isolation: isolate; overflow: hidden; display: block; min-height: 112px; padding: 15px 22px 20px; color: #f2ede4; cursor: pointer; outline: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cd) 14%, #0a0b10), #050608 75%);
  border: 1px solid color-mix(in srgb, var(--cd) 42%, #ffffff14);
  box-shadow: 0 10px 26px #0009, inset 0 1px 0 #ffffff10;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  animation: cdIn .5s cubic-bezier(.2, .9, .3, 1.1) both; -webkit-tap-highlight-color: transparent;
  container-type: inline-size }   /* جولة 58ب: الترتيب حسب عرض الشريط نفسه — مو الشاشة */
@keyframes cdIn { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }
.cdx::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; z-index: 4; pointer-events: none; background: repeating-linear-gradient(-45deg, var(--cd) 0 8px, #0a0b0f 8px 16px) }
.cdx:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--cd) 70%, #fff), 0 10px 26px #0009 }

/* الخلفية: صورة (اختيارية) تميل مع الماوس + تعتيم ناحية النص + خطوط مسح */
.cd-bg { position: absolute; inset: -8%; z-index: -3; background: center / cover no-repeat; opacity: .95;
  transform: translate(calc(var(--mx) * -16px), calc(var(--my) * -10px)) scale(1.04); transition: transform .3s ease-out }
.cd-bg::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(to left, rgba(5, 6, 8, calc(var(--cdd) + .3)) 0%, rgba(5, 6, 8, var(--cdd)) 45%, rgba(5, 6, 8, calc(var(--cdd) * .55)) 100%) }
.cd-scan { position: absolute; inset: 0; z-index: -2; pointer-events: none; background: repeating-linear-gradient(0deg, #ffffff06 0 1px, transparent 1px 3px) }
.cd-scan::after { content: ''; position: absolute; inset-inline: 0; height: 30%; top: -30%; background: linear-gradient(transparent, color-mix(in srgb, var(--cd) 9%, transparent), transparent); animation: cdScan 5s linear infinite }
@keyframes cdScan { to { top: 110% } }
.cd-alarm { position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 50%, transparent 35%, color-mix(in srgb, var(--cd) 50%, transparent)) }
.cd-flash { position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0; background: #fff }
.cd-rv { position: absolute; width: 7px; height: 7px; border-radius: 50%; z-index: 5; background: radial-gradient(circle at 35% 35%, #b4bac6, #2a2d36 70%); box-shadow: 0 1px 0 #000, 0 0 0 1px #00000066 }
.cd-rv.a { top: 11px; right: 11px } .cd-rv.b { top: 15px; left: 15px } .cd-rv.c { bottom: 15px; right: 15px } .cd-rv.d { bottom: 11px; left: 11px }

/* الرأس */
.cd-run, .cd-endv { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 76px }
.cd-head { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding-inline-start: 6px }
.cd-k { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; padding: 2px 10px 2px 9px; font-size: .72rem; font-weight: 900; color: color-mix(in srgb, var(--cd) 50%, #fff);
  background: #000a; border: 1px solid color-mix(in srgb, var(--cd) 55%, transparent); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%) }
.cd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cd); box-shadow: 0 0 8px var(--cd); animation: cdDot 1.2s steps(1) infinite }
@keyframes cdDot { 50% { opacity: .15 } }
.cd-t { font-size: 1.3rem; font-weight: 900; line-height: 1.25; text-shadow: 0 2px 6px #000, 0 0 16px color-mix(in srgb, var(--cd) 45%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100% }
.cd-s { font-size: .82rem; opacity: .75; text-shadow: 0 1px 3px #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100% }

/* الساعة: أنابيب نيكسي */
.cd-clock { flex: none; display: flex; align-items: flex-start; gap: 6px; transform: perspective(520px) rotateY(calc(var(--mx) * -12deg)) rotateX(calc(var(--my) * 9deg)); transition: transform .3s ease-out }
.cd-u { display: flex; flex-direction: column; align-items: center; gap: 4px }
.cd-u[hidden], .cd-sep[hidden] { display: none }
.cd-u small { font-size: .62rem; font-weight: 800; opacity: .6 }
.cd-tubes { display: flex; gap: 3px; padding: 4px; background: linear-gradient(#1b1d24, #0b0c10); border: 1px solid #ffffff16; border-radius: 5px; box-shadow: inset 0 2px 6px #000, 0 2px 0 #000 }
.cd-tube { position: relative; width: 30px; height: 46px; display: grid; place-items: center; overflow: hidden; border-radius: 13px 13px 5px 5px;
  background: radial-gradient(ellipse at 50% 42%, color-mix(in srgb, var(--cd) 20%, #120704), #050302 75%);
  box-shadow: inset 0 0 0 1px #ffffff12, inset 0 -8px 12px #000c }
.cd-tube::before { content: ''; position: absolute; inset: 0; z-index: 2; opacity: .55; background: radial-gradient(circle, #ffffff16 .7px, transparent 1.1px) 0 0 / 4px 4px }
.cd-tube::after { content: ''; position: absolute; inset: 0; z-index: 3; background: linear-gradient(100deg, #ffffff2a 0 7%, transparent 28%), linear-gradient(transparent 72%, #ffffff0c) }
.cd-ghost, .cd-tube b { grid-area: 1 / 1; font: 700 32px/1 ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace; font-style: normal }
.cd-ghost { color: color-mix(in srgb, var(--cd) 26%, transparent); opacity: .3 }
.cd-tube b { position: relative; z-index: 1; color: color-mix(in srgb, var(--cd) 28%, #fff); text-shadow: 0 0 2px var(--cd), 0 0 9px var(--cd), 0 0 22px var(--cd) }
.cd-tube.flk b { animation: cdFlk .34s steps(1) }
@keyframes cdFlk { 0% { opacity: .12 } 25% { opacity: 1 } 45% { opacity: .35 } 62%, 100% { opacity: 1 } }
.cd-sep { display: flex; flex-direction: column; gap: 10px; padding-top: 15px }
.cd-sep b { width: 5px; height: 5px; background: var(--cd); box-shadow: 0 0 7px var(--cd); transition: opacity .15s }
.cdx.blink .cd-sep b { opacity: .22 }

/* الفتيل: يحترق من بداية العد لنهايته — والشرارة على الحد */
/* جولة 63: الشريط صار «تقدّم»: يبدأ فاضي يوم ضبط الموعد، ويمتلي من البداية (يمين) لين يوصل الصفر.
   قبل كان العكس (الفتيل المضيء هو الباقي)، فالعين تقراه كأنه قرّب يخلص. */
.cd-fuse { position: absolute; inset-inline: 22px; bottom: 8px; height: 3px; pointer-events: none;
  background: repeating-linear-gradient(90deg, #3a3a3e 0 3px, #1b1b1e 3px 5px); border-radius: 2px }
.cd-ash { position: absolute; inset-block: 0; inset-inline-start: 0; width: calc(var(--burn) * 100%); border-radius: 2px; overflow: hidden;
  background: linear-gradient(to left, var(--cd), color-mix(in srgb, var(--cd) 55%, #fff)); box-shadow: 0 0 6px var(--cd), 0 0 12px color-mix(in srgb, var(--cd) 50%, transparent) }
[dir=ltr] .cd-ash { background: linear-gradient(to right, var(--cd), color-mix(in srgb, var(--cd) 55%, #fff)) }
.cd-ash::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, #ffffff88, transparent); background-size: 40px 100%; background-repeat: no-repeat; animation: cdFill 2.4s linear infinite }
@keyframes cdFill { from { background-position: 120% 0 } to { background-position: -40px 0 } }
@media (prefers-reduced-motion: reduce) { .cd-ash::after { animation: none } }
.cd-spark { position: absolute; top: 50%; inset-inline-start: calc(var(--burn) * 100%); width: 0; height: 0 }
.cd-spark::before { content: ''; position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #fff6d8; box-shadow: 0 0 6px #fff, 0 0 12px var(--cd), 0 0 20px var(--cd); animation: cdSpk .18s steps(2) infinite }
.cd-spark b { position: absolute; left: -1px; top: -1px; width: 2px; height: 2px; background: #ffd9a0; box-shadow: 0 0 4px var(--cd); animation: cdSpark .6s ease-out infinite }
.cd-spark b:nth-child(2) { animation-delay: .2s; --dx: -9px; --dy: -11px } .cd-spark b:nth-child(3) { animation-delay: .4s; --dx: 7px; --dy: -8px }
@keyframes cdSpk { 50% { transform: scale(.7) } }
@keyframes cdSpark { from { transform: none; opacity: 1 } to { transform: translate(var(--dx, -4px), var(--dy, -13px)); opacity: 0 } }

/* جولة 58ب: الشريط الضيق (وسط القائمة بالكمبيوتر والجوال): العنوان سطر كامل فوق، والساعة تحته بالنص —
   كان العنوان ينقطع («الت…») والسطر الصغير ينضغط لما تطلع الأيام */
@container (max-width: 760px) {
  .cd-run { flex-direction: column; align-items: stretch; gap: 10px; min-height: 0 }
  .cd-run .cd-head { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 2px; padding-inline-start: 0; padding-inline-end: 18px }
  .cd-run .cd-t { flex: 1 1 0; min-width: 40%; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 1.22rem }
  .cd-run .cd-s { flex-basis: 100% }
  .cd-clock { align-self: center }
  .cd-endv { gap: 12px }
  .cd-endv .cd-head { min-width: 0; flex: 1 }
  .cd-et { font-size: 1.6rem; overflow-wrap: anywhere }
}
@container (max-width: 380px) { .cd-endv { flex-direction: column; align-items: stretch; text-align: center } .cd-endv .cd-head { align-items: center } .cd-acts { align-self: center } }

/* آخر دقيقة: إنذار ينبض — آخر عشر ثواني: كل ثانية رجّة */
.cdx.crit { border-color: var(--cd) }
.cdx.crit .cd-alarm { animation: cdAlarm 1s ease-in-out infinite }
@keyframes cdAlarm { 0%, 100% { opacity: .15 } 50% { opacity: .75 } }
.cdx.crit .cd-dot { animation-duration: .4s }
.cdx.kick .cd-clock { animation: cdKick .32s ease-out }
@keyframes cdKick { 0% { scale: 1.07 } 100% { scale: 1 } }
.cdx.last .cd-tube b { color: #fff }

/* الصفر: ومضة + رجّة + تشويش، ثم النهاية */
.cdx.boom { animation: cdShake .5s steps(6) }
.cdx.boom .cd-flash { animation: cdFlash .65s ease-out }
@keyframes cdFlash { 0% { opacity: 0 } 12% { opacity: .9 } 100% { opacity: 0 } }
@keyframes cdShake { 0%, 100% { transform: none } 20% { transform: translate(-4px, 2px) } 40% { transform: translate(3px, -2px) } 60% { transform: translate(-2px, -1px) } 80% { transform: translate(2px, 1px) } }
.cd-endv { display: none }
.cdx.ended .cd-run, .cdx.ended .cd-fuse { display: none }
.cdx.ended .cd-endv { display: flex; animation: cdIn .45s ease both }
.cd-et { position: relative; font-size: 1.9rem; font-weight: 900; line-height: 1.2; color: #fff; text-shadow: 0 0 6px var(--cd), 0 0 22px var(--cd), 0 3px 0 #000 }
.cd-et::before, .cd-et::after { content: attr(data-t); position: absolute; inset: 0; pointer-events: none; opacity: .8 }
.cd-et::before { color: #ff2a4a; transform: translate(2px, 0); clip-path: inset(0 0 60% 0); animation: cdGl1 2.6s steps(1) infinite }
.cd-et::after { color: #2affe1; transform: translate(-2px, 0); clip-path: inset(55% 0 0 0); animation: cdGl2 2.6s steps(1) infinite }
@keyframes cdGl1 { 0%, 86%, 100% { opacity: 0 } 88% { opacity: .85; transform: translate(3px, -1px) } 92% { opacity: .85; transform: translate(-2px, 1px) } }
@keyframes cdGl2 { 0%, 86%, 100% { opacity: 0 } 89% { opacity: .85; transform: translate(-3px, 1px) } 93% { opacity: .85; transform: translate(2px, 0) } }
.cd-acts { flex: none }
.cd-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; font: inherit; font-size: .95rem; font-weight: 900; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cd) 90%, #fff), color-mix(in srgb, var(--cd) 70%, #000)); border: 1px solid #ffffff33;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); box-shadow: 0 0 22px color-mix(in srgb, var(--cd) 60%, transparent);
  animation: cdBtn 1.6s ease-in-out infinite; transition: transform .15s }
.cd-btn svg { width: 16px; height: 16px }
.cd-btn:hover { transform: translateX(-3px) }
@keyframes cdBtn { 50% { filter: brightness(1.25) } }

.cdx.hideout { opacity: 0; transform: scaleY(.4); transition: opacity .6s ease, transform .6s ease; animation: none }

/* التفاعل: نبضة من مكان الضغطة + الموعد بتوقيت اللاعب */
.cd-ping { position: absolute; z-index: 5; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid var(--cd); pointer-events: none; animation: cdPing .9s ease-out forwards }
@keyframes cdPing { from { transform: scale(1); opacity: .9 } to { transform: scale(26); opacity: 0 } }
.cd-tip { position: absolute; z-index: 6; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 3px 12px; font-size: .74rem; font-weight: 800; white-space: nowrap;
  background: #000d; border: 1px solid color-mix(in srgb, var(--cd) 50%, transparent); animation: cdIn .2s ease both }
.cd-tip[hidden] { display: none }

/* الجوال بالعرض: شريط أنحف */
@media (orientation: landscape) and (max-height: 500px) {
  .cdx { min-height: 0; padding: 8px 14px 12px }
  .cd-run, .cd-endv { min-height: 44px; gap: 10px }
  .cd-t { font-size: .95rem } .cd-s { display: none } .cd-k { font-size: .6rem; padding: 0 8px } .cd-dot { width: 5px; height: 5px }
  .cd-clock { gap: 3px } .cd-tubes { padding: 2px; gap: 2px } .cd-tube { width: 19px; height: 28px; border-radius: 8px 8px 3px 3px }
  .cd-ghost, .cd-tube b { font-size: 19px } .cd-u { gap: 2px } .cd-u small { font-size: .5rem }
  .cd-sep { gap: 6px; padding-top: 9px } .cd-sep b { width: 3px; height: 3px }
  .cd-fuse { bottom: 5px; height: 2px; inset-inline: 14px }
  .cd-et { font-size: 1.2rem } .cd-btn { padding: 6px 12px; font-size: .8rem }
  .cd-rv { display: none }
}
@media (prefers-reduced-motion: reduce) { .cdx, .cdx *, .cdx::before, .cdx *::before, .cdx *::after { animation: none !important; transition: none !important } .cd-clock, .cd-bg { transform: none !important } }
