/* ═══════════════════════════════════════════════════════
   MODAL / MODAL — نافذة تفاصيل الكلمة: السلسلة الاشتقاقية
   + التراكيب الشائعة + المثال + أزرار SRS + الكلمات المرتبطة
   ═══════════════════════════════════════════════════════ */

/* ── MODAL ── */
.ov {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 400;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.ov.on {
  display: flex;
  animation: ov_ .15s ease;
}
@keyframes ov_ {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal {
  background: var(--sur);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--brd2);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: mu .22s cubic-bezier(.32, .72, 0, 1);
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}
@keyframes mu {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.mh_ {
  width: 36px;
  height: 4px;
  background: var(--brd2);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.mh {
  padding: 13px 15px 11px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border-bottom: 1px solid var(--brd);
  flex-shrink: 0;
}
.mhi {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.mhi2 {
  flex: 1;
  min-width: 0;
}
.mps {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .5rem;
  font-weight: 700;
  letter-spacing: .1em;
  padding: 2px 7px;
  border-radius: 9px;
  display: inline-block;
  margin-bottom: 4px;
}
.mw {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--txt);
  direction: ltr;
  line-height: 1.1;
}
.mph {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .7rem;
  color: var(--muted);
  margin-top: 2px;
  direction: ltr;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ma {
  font-size: .9rem;
  font-weight: 700;
  color: var(--txt);
  margin-top: 2px;
}
.mr {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}
.mcl {
  background: var(--sur2);
  border: 1px solid var(--brd2);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sub);
  transition: all var(--t);
}
.mcl:hover {
  background: var(--brd2);
  color: var(--txt);
}
.spk {
  background: var(--v-bg);
  border: 1.5px solid var(--v-brd);
  color: var(--v);
  font-size: .66rem;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--t);
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
}
.spk:hover {
  filter: brightness(.92);
}
.mlv {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .58rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
}
.mbd {
  padding: 13px 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mb {
  background: var(--sur2);
  border: 1px solid var(--brd);
  border-radius: var(--rsm);
  padding: 10px 12px;
}
.mbl {
  font-size: .5rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .1em;
  margin-bottom: 7px;
}

/* ── CHAIN ── */
.chain {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  direction: ltr;
  margin-bottom: 6px;
}
.chs {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.chw {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 7px;
}
.chs2 {
  font-size: .46rem;
  color: var(--muted);
}
.charr {
  color: var(--muted);
  font-size: .82rem;
  padding-bottom: 9px;
}
.chop {
  color: var(--muted);
  font-size: .72rem;
  padding: 2px 2px 11px;
}
.crule {
  font-size: .7rem;
  color: var(--sub);
  line-height: 1.8;
  direction: rtl;
}
.crule b {
  color: var(--gold);
}

/* ── COLLOCATIONS ── */
.col {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 9px;
  padding: 4px 0;
  border-bottom: 1px solid var(--brd);
  font-size: .67rem;
}
.col:last-child {
  border-bottom: none;
}
.cole {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  color: var(--txt);
  direction: ltr;
}
.cole span {
  color: var(--v);
}
.cola {
  color: var(--sub);
}

/* ── EXAMPLE & TIP ── */
.ex {
  background: var(--v-bg);
  border: 1px solid var(--v-brd);
  border-right: 3px solid var(--v);
  border-radius: var(--rsm);
  padding: 10px 12px;
}
.exe {
  font-size: .8rem;
  font-weight: 700;
  color: var(--txt);
  direction: ltr;
  line-height: 1.65;
}
.exe em {
  color: var(--v);
  font-style: normal;
  font-weight: 900;
}
.exa {
  font-size: .7rem;
  color: var(--sub);
  margin-top: 3px;
}
.tip {
  background: var(--gold-bg);
  border: 1px solid var(--d-brd);
  border-right: 3px solid var(--gold);
  border-radius: var(--rsm);
  padding: 10px 12px;
}
.tip p {
  font-size: .7rem;
  color: var(--sub);
  line-height: 1.8;
}
.tip b {
  color: var(--gold);
}

/* ── SRS BUTTONS ── */
.srsbox {
  background: var(--sur2);
  border: 1px solid var(--brd);
  border-radius: var(--rsm);
  padding: 10px 12px;
}
.srsl {
  font-size: .5rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .1em;
  margin-bottom: 7px;
}
.srsrow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.srsb {
  padding: 9px 3px;
  border-radius: var(--rsm);
  border: 1.5px solid var(--brd);
  background: var(--sur);
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .55rem;
  cursor: pointer;
  transition: transform .15s cubic-bezier(.34, 1.56, .64, 1), box-shadow .15s ease, background .15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  overflow: hidden;
}
.srsb:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: var(--sh2);
}
.srsb:active {
  transform: scale(.92);
}
.srsb .se {
  font-size: .9rem;
}
.srsb .st__ {
  font-size: .4rem;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--muted);
  margin-top: 1px;
}
.srsb.r1 {
  border-color: var(--p-brd);
  color: var(--p);
}
.srsb.r1:hover {
  background: var(--p-bg);
}
.srsb.r2 {
  border-color: var(--d-brd);
  color: var(--d);
}
.srsb.r2:hover {
  background: var(--d-bg);
}
.srsb.r3 {
  border-color: var(--n-brd);
  color: var(--n);
}
.srsb.r3:hover {
  background: var(--n-bg);
}
.srsb.r4 {
  border-color: var(--v-brd);
  color: var(--v);
}
.srsb.r4:hover {
  background: var(--v-bg);
}

/* ── RELATED WORDS ── */
.rel-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.rel-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: .52rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--t);
  border: 1.5px solid;
}
.rel-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--sh);
}

/* ── MODAL FOOTER ── */
.mf {
  padding: 10px 15px;
  border-top: 1px solid var(--brd);
  display: flex;
  gap: 7px;
  flex-shrink: 0;
  background: var(--sur);
  position: sticky;
  bottom: 0;
}
.nb2 {
  flex: 1;
  background: var(--sur2);
  border: 1px solid var(--brd2);
  border-radius: var(--rsm);
  padding: 9px 5px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: .66rem;
  color: var(--sub);
  cursor: pointer;
  transition: all var(--t);
}
.nb2:hover:not(:disabled) {
  background: var(--brd);
  color: var(--txt);
}
.nb2:disabled {
  opacity: .3;
  cursor: not-allowed;
}
.nb2.pr {
  background: var(--v);
  color: #fff;
  border-color: var(--v);
  font-weight: 900;
}
.nb2.pr:hover {
  filter: brightness(1.12);
}


/* ── الكشف التدريجي داخل النافذة ── */
.mrev {
  margin-top: 8px;
  border: 1px solid var(--brd);
  border-radius: var(--rsm);
  background: var(--sur2);
  overflow: hidden;
}
.mrev summary {
  list-style: none;
  cursor: pointer;
  padding: 7px 10px;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--sub);
  transition: color var(--t-fast), background var(--t-fast);
}
.mrev summary::-webkit-details-marker { display: none; }
.mrev summary::after { content: ' ▾'; color: var(--muted); }
.mrev[open] summary::after { content: ' ▴'; }
.mrev summary:hover { color: var(--txt); background: var(--sur); }
.mrev[open] summary { border-bottom: 1px solid var(--brd); color: var(--txt); }
.mrev > *:not(summary) { margin: 8px 10px; }
