/* ============================================================
   WHAT IF — ماذا لو؟
   Branching scenario stories with multiple endings
   ============================================================ */

.wi-panel {
  background:
    radial-gradient(140% 80% at 50% 0%, rgba(205,235,215,0.32), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  padding: var(--s-8);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-card);
}
.wi-panel .activity-tag { background: var(--mint); color: var(--mint-ink); }
.wi-panel .activity-tag::before { background: var(--mint-ink); }

.wi-hud {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.wi-hud .hud-block {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; color: var(--muted); font-weight: 600;
}
.wi-hud .hud-block strong {
  font-size: 20px; color: var(--ink);
  font-family: var(--font-en); font-weight: 800;
}
.wi-hud small { color: var(--muted); font-family: var(--font-en); margin-right: 2px; }

/* مُحَدِّد القِصَص */
.wi-story-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.wi-story-card {
  background: var(--bg-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  text-align: right;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
  display: flex; gap: var(--s-3); align-items: center;
}
.wi-story-card:hover { background: var(--surface); border-color: var(--brand); transform: translateY(-2px); }
.wi-story-card.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}
.wi-story-card .ic {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
  flex-shrink: 0;
  font-size: 20px;
}
.wi-story-card.active .ic { background: var(--brand); color: #fff; }
.wi-story-card .meta strong {
  display: block; font-size: 14px; font-weight: 800;
  line-height: 1.3;
}
.wi-story-card .meta small {
  display: block; font-size: 11px; color: var(--muted);
  margin-top: 2px; font-weight: 600;
}
.wi-story-card .endings-mini {
  display: flex; gap: 2px; margin-top: 4px;
}
.wi-story-card .endings-mini span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--line);
}
.wi-story-card .endings-mini span.done {
  background: var(--brand);
}

/* المَسرَح */
.wi-stage {
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(255,233,168,0.4), transparent 60%),
    linear-gradient(180deg, #FFFBF3 0%, #F5EEDF 100%);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  padding: var(--s-5);
  display: flex; flex-direction: column;
  gap: var(--s-4);
  min-height: 480px;
}

.wi-story-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px dashed var(--line);
}
.wi-story-meta {
  display: flex; align-items: center; gap: 12px;
}
.wi-story-ic {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800;
}
.wi-story-meta strong {
  display: block; font-size: 17px; font-weight: 800;
}
.wi-story-meta small {
  display: block; font-size: 11px; color: var(--muted);
  font-weight: 600;
}

/* خَريطَة المَسار */
.wi-breadcrumb {
  display: flex; gap: 4px;
  align-items: center;
}
.wi-breadcrumb .step {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s ease, transform 0.2s ease;
}
.wi-breadcrumb .step.active {
  background: var(--brand);
  transform: scale(1.4);
}
.wi-breadcrumb .step.past {
  background: var(--brand-soft);
}
.wi-breadcrumb .arrow {
  font-size: 10px;
  color: var(--muted);
}

/* المَشهَد */
.wi-scene {
  background: var(--surface);
  border: 1.5px solid var(--brand);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  display: flex; flex-direction: column;
  gap: 8px;
  animation: wi-scene-in 0.5s cubic-bezier(.2,1.4,.4,1);
}
@keyframes wi-scene-in {
  0% { transform: translateX(20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
.wi-scene-label {
  display: inline-flex; align-self: flex-start;
  align-items: center; gap: 6px;
  padding: 3px 10px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 800;
  font-family: var(--font-en);
  letter-spacing: 0.04em;
}
.wi-scene-text {
  margin: 0;
  font-size: 17px; font-weight: 600;
  line-height: 1.8;
  color: var(--ink);
}

/* الخَيارات */
.wi-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}
.wi-choice {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-4);
  text-align: right;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
  display: flex; flex-direction: column; gap: 6px;
  font-weight: 700;
  position: relative;
  min-height: 80px;
}
.wi-choice .key {
  font-size: 10px; font-weight: 800; color: var(--muted);
  font-family: var(--font-en);
  letter-spacing: 0.05em;
}
.wi-choice .text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.wi-choice:hover {
  background: var(--bg-soft);
  border-color: var(--brand);
  transform: translateY(-2px);
}
.wi-choice .arrow {
  position: absolute; left: 12px; bottom: 12px;
  font-size: 18px; color: var(--muted);
  opacity: 0; transition: opacity 0.2s ease, transform 0.2s ease;
}
.wi-choice:hover .arrow {
  opacity: 1; transform: translateX(-4px);
}

/* النِّهايَة */
.wi-outcome {
  background: var(--surface);
  border: 2px solid;
  border-radius: var(--r-lg);
  padding: var(--s-5);
  display: flex; flex-direction: column;
  gap: var(--s-3);
  animation: wi-outcome-in 0.6s cubic-bezier(.2,1.4,.4,1);
}
@keyframes wi-outcome-in {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.wi-outcome.kind-excellent { border-color: var(--mint-ink); background: linear-gradient(180deg, #ECFAEF 0%, var(--surface) 100%); }
.wi-outcome.kind-good      { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface) 100%); }
.wi-outcome.kind-neutral   { border-color: var(--butter-ink); background: linear-gradient(180deg, #FFFBE0 0%, var(--surface) 100%); }
.wi-outcome.kind-bad       { border-color: var(--peach-ink); background: linear-gradient(180deg, #FFF0EE 0%, var(--surface) 100%); }

.wi-outcome .o-head {
  display: flex; align-items: center; gap: 12px;
}
.wi-outcome .o-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 900;
  flex-shrink: 0;
}
.wi-outcome.kind-excellent .o-icon { background: var(--mint-ink); color: #fff; }
.wi-outcome.kind-good      .o-icon { background: var(--brand); color: #fff; }
.wi-outcome.kind-neutral   .o-icon { background: var(--butter-ink); color: #fff; }
.wi-outcome.kind-bad       .o-icon { background: var(--peach-ink); color: #fff; }

.wi-outcome .o-label {
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  font-family: var(--font-en);
}
.wi-outcome.kind-excellent .o-label { color: var(--mint-ink); }
.wi-outcome.kind-good      .o-label { color: var(--brand-ink); }
.wi-outcome.kind-neutral   .o-label { color: var(--butter-ink); }
.wi-outcome.kind-bad       .o-label { color: var(--peach-ink); }

.wi-outcome .o-title {
  font-size: 18px; font-weight: 800; color: var(--ink);
  margin-top: 2px;
}
.wi-outcome .o-body {
  font-size: 14px; line-height: 1.7; color: var(--ink-2);
}
.wi-outcome .o-quote {
  font-family: 'Amiri', serif;
  font-size: 14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.55);
  border-radius: var(--r-sm);
  border-right: 3px solid currentColor;
  line-height: 1.7;
}
.wi-outcome.kind-excellent .o-quote { color: var(--mint-ink); }
.wi-outcome.kind-good      .o-quote { color: var(--brand-ink); }
.wi-outcome.kind-neutral   .o-quote { color: var(--butter-ink); }
.wi-outcome.kind-bad       .o-quote { color: var(--peach-ink); }

.wi-controls {
  display: flex; gap: 8px; justify-content: center;
  margin-top: auto;
}
.wi-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-weight: 700; font-size: 13px;
  color: var(--ink-2);
  transition: background 0.18s ease, transform 0.15s ease;
}
.wi-btn:hover:not(:disabled) { background: var(--bg-soft); transform: translateY(-1px); }
.wi-btn.primary {
  background: var(--mint-ink); color: #fff; border-color: var(--mint-ink);
}
.wi-btn.primary:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); }
.wi-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* قائمة نِهايات الجانِبيَّة */
.wi-endings-list {
  display: flex; flex-direction: column; gap: 8px;
}
.wi-end-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.4;
}
.wi-end-row .seal {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(122,122,140,0.25);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 900;
  color: var(--muted);
}
.wi-end-row.found { font-weight: 700; }
.wi-end-row.found .seal { color: #fff; }
.wi-end-row.kind-excellent.found { background: linear-gradient(180deg, #ECFAEF 0%, var(--surface) 100%); border-color: var(--mint-ink); }
.wi-end-row.kind-excellent.found .seal { background: var(--mint-ink); }
.wi-end-row.kind-good.found { background: var(--brand-soft); border-color: var(--brand); }
.wi-end-row.kind-good.found .seal { background: var(--brand); }
.wi-end-row.kind-neutral.found { background: #FFFBE0; border-color: var(--butter-ink); }
.wi-end-row.kind-neutral.found .seal { background: var(--butter-ink); }
.wi-end-row.kind-bad.found { background: #FFF0EE; border-color: var(--peach-ink); }
.wi-end-row.kind-bad.found .seal { background: var(--peach-ink); }
.wi-end-row .nm small {
  display: block; font-size: 11px; color: var(--muted); font-weight: 600;
  margin-top: 2px;
}

@media (max-width: 720px) {
  .wi-story-picker { grid-template-columns: 1fr; }
  .wi-choices { grid-template-columns: 1fr; }
}
