/* ممالك الأساطير — v7 §3.1 (R2): الويكي العام /wiki. يُحمَّل بعد style.css (رموز الألوان الثلاثة: الياقوت والخشب والعقيق، والأزرار
   والجداول والشرائح)، ويعيد للصفحة التمرير وتحديد النص (style.css يثبّت صفحة اللعبة). جدول المحتويات على اليسار في الاتجاهين (عربية
   وإنجليزية)، وعلى الهاتف كتلة قابلة للطي فوق الأقسام. الألوان من الرموز وحدها. */
/* overflow-x: clip (لا hidden): لا يجعل الصفحة حاوية تمرير فيبقى الرأس وجدول المحتويات لاصقين */
html.wiki, html.wiki body { height: auto; min-height: 100%; overflow: visible; user-select: text; -webkit-user-select: text; }
html.wiki body { overflow-x: clip; }
html.wiki body {
  margin: 0; line-height: 1.75; font-size: 15px;
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(var(--rgb-glow), 0.22), transparent 70%),
    var(--tex-sky) 0 0 / var(--tex-sky-size),
    linear-gradient(180deg, var(--login-1) 0%, var(--login-2) 60%, var(--night) 100%);
  background-attachment: fixed;
}
html.wiki img { -webkit-user-drag: none; }
html.wiki [hidden] { display: none !important; }
.wk-n { font-variant-numeric: tabular-nums; unicode-bidi: isolate; direction: ltr; }

/* ---------------------------------------------------------------- الرأس */
.wk-head { position: sticky; top: 0; z-index: 10; background: var(--tex-panel), var(--glass); border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.wk-head-in { max-width: 1280px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wk-brand { display: flex; align-items: center; gap: 10px; color: var(--ivory); text-decoration: none; flex: none; }
.wk-brand:hover { text-decoration: none; color: var(--gold-hi); }
.wk-brand b { display: block; font-family: var(--title); font-size: 19px; color: var(--gold); line-height: 1.2; }
.wk-brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.wk-crest { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }
.wk-search { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 12px;
  background: rgba(var(--rgb-well), 0.6); border: 1px solid var(--line); }
.wk-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ivory); font: inherit; font-weight: 700; padding: 6px 0; }
.wk-search input::placeholder { color: rgba(var(--rgb-hair), 0.55); }
.wk-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(233, 196, 106, 0.18); }
.wk-online { flex: none; }
.wk-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wk-langs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.wk-langs a { padding: 4px 12px; font-weight: 800; font-size: 13px; color: var(--cream); text-decoration: none; }
.wk-langs a.on { background: linear-gradient(180deg, var(--tab-1), var(--tab-2)); color: #fff; }
.wk-langs a:hover { text-decoration: none; color: var(--gold-hi); }
.wk-themes { display: inline-flex; gap: 6px; }
.wk-th { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(var(--rgb-hair), 0.45); cursor: pointer; padding: 0; }
.wk-th.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(233, 196, 106, 0.35); }
.wk-th-sapphire { background: linear-gradient(135deg, #3a63c9, #0e1a46); }
.wk-th-wood { background: linear-gradient(135deg, #b07a3a, #2a160a); }
.wk-th-onyx { background: linear-gradient(135deg, #5a5a5a, #0c0c0c); }

/* ---------------------------------------------------------------- المحتويات والأقسام: المحتويات على اليسار في الاتجاهين */
.wk-layout { max-width: 1280px; margin: 0 auto; padding: 18px 16px 40px; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px;
  direction: ltr; align-items: start; }
.wk-layout > * { direction: rtl; }
html[dir="ltr"] .wk-layout > * { direction: ltr; }
.wk-toc { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--tex-panel), var(--glass); padding: 10px 8px; }
.wk-toc summary { display: none; }
.wk-toc ol { list-style: none; margin: 0; padding: 0; }
.wk-toc a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; color: var(--cream); font-weight: 700; text-decoration: none; }
.wk-toc a:hover { background: rgba(var(--rgb-glow), 0.14); color: var(--gold-hi); text-decoration: none; }
.wk-toc a.on { background: rgba(233, 196, 106, 0.16); color: var(--gold); }
.wk-main { min-width: 0; }
.wk-sec { position: relative; margin: 0 0 22px; padding: 18px 20px 20px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--tex-panel), var(--glass); box-shadow: var(--shadow); scroll-margin-top: 80px; }
.wk-sec h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-family: var(--title); font-size: 25px; color: var(--gold);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.wk-sub { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-family: var(--title); font-size: 19px; color: var(--gold-hi); scroll-margin-top: 80px; }
.wk-lead { color: var(--cream); margin: 0 0 12px; }
.wk-muted { color: var(--muted); }
.wk-now { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-radius: 10px; background: rgba(233, 196, 106, 0.1);
  border: 1px solid rgba(233, 196, 106, 0.3); font-weight: 800; color: var(--gold-hi); }
.wk-none { padding: 16px; text-align: center; color: var(--muted); }
.wk-sec p { margin: 0 0 8px; }
.wk-sec h3, .wk-sec h4 { margin: 0 0 6px; color: var(--ivory); }
.wk-sec h3 small, .wk-sec h4 small { color: var(--muted); font-weight: 700; font-size: 0.82em; }

/* بطاقات قابلة للبحث */
.wk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin: 0 0 12px; }
.wk-grid-s { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.wk-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* (القبائل الأربع وقلاع المجهول الأربع: 2 × 2، لا بطاقة وحيدة في سطر) */
article.wk-item { padding: 12px 14px; border-radius: 12px; background: rgba(var(--rgb-well), 0.42); border: 1px solid var(--line-soft); margin: 0 0 12px; min-width: 0; }
.wk-grid > article.wk-item { margin: 0; }
article.wk-plain { background: rgba(var(--rgb-well), 0.28); }
.wk-row { display: flex; align-items: flex-start; gap: 12px; }
.wk-row > div { min-width: 0; flex: 1; }
.wk-row > img, .wk-row > .wk-spr, .wk-row > .wk-noimg { flex: none; }
.wk-feat { text-align: center; }
.wk-feat > img, .wk-feat > .wk-spr, .wk-feat > .wk-noimg { display: block; margin: 0 auto 6px; }
.wk-tribe { border-top: 3px solid var(--tc, var(--line)); }
.wk-tart { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin: 0 0 8px; min-height: 120px; }
.wk-bon { margin: 0 0 8px; padding-inline-start: 20px; color: var(--cream); }
.wk-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 14px; }
.wk-dl dt { color: var(--gold); font-weight: 800; }
.wk-dl dd { margin: 0; color: var(--cream); }
.wk-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.wk-facts .pill { white-space: normal; font-size: 12px; border-radius: 12px; }
.wk-tiers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wk-tiers figure { margin: 0; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 4px; padding: 6px 8px 4px;
  border-radius: 10px; background: rgba(var(--rgb-well), 0.35); border: 1px solid var(--line-soft); }
.wk-tiers figcaption { width: 100%; text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; }
.wk-tiers-one { justify-content: center; }
.wk-secret { color: var(--tint2); font-style: italic; display: flex; align-items: center; gap: 6px; }
.wk-mons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-items: center; align-items: end; gap: 6px; margin: 6px 0 10px; }
.wk-mon { margin: 0; text-align: center; font-weight: 800; color: var(--muted); }
.wk-mon figcaption { font-size: 13px; letter-spacing: 2px; }
.wk-castle { text-align: center; }
.wk-castle > img, .wk-castle > .wk-noimg { display: block; margin: 0 auto 6px; }
.wk-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.wk-list li { padding: 2px 10px; border-radius: 999px; background: rgba(var(--rgb-well), 0.4); border: 1px solid var(--line-soft); }

/* الصور: صفيحة الوحدات تُقص إلى إطار الوقوف (يسار الصفيحة في الاتجاهين) */
.wk-img, .wk-spr { vertical-align: middle; }
.wk-img { object-fit: contain; height: auto; }
.wk-spr { display: inline-block; position: relative; overflow: hidden; direction: ltr; flex: none; }
.wk-spr img { position: absolute; top: 0; max-width: none; }
.wk-noimg { display: inline-block; border-radius: 12px; background: rgba(var(--rgb-hair), 0.08); border: 1px dashed var(--line-soft); vertical-align: middle; }
.wk-ic { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45)); }
/* الأسرار: ظل داكن بلا ملامح */
.wk-shadow { filter: brightness(0) drop-shadow(0 0 7px rgba(164, 108, 245, 0.6)); opacity: 0.92; }

/* الجداول */
.wk-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 10px; -webkit-overflow-scrolling: touch; }
.wk-tbl { min-width: 560px; }
.wk-tbl td small { display: block; color: var(--muted); font-weight: 700; }
.wk-tbl td small bdi, .wk-ltbl td small { display: inline; }
.wk-tbl .wk-desc { display: block; font-size: 12px; color: var(--muted); max-width: 360px; line-height: 1.5; }
.wk-tbl th img.wk-ic { width: 18px; height: 18px; }
.wk-cost span { display: inline-flex; align-items: center; gap: 2px; margin-inline-end: 6px; white-space: nowrap; font-size: 12.5px; }
.wk-ltbl { min-width: 480px; }
.wk-ltbl td:nth-last-child(-n+2) { font-weight: 800; }

/* الترتيب والأرشيف */
.wk-lmeta { color: var(--muted); font-weight: 700; margin: 0 0 8px; }
.wk-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.wk-tabs button { cursor: pointer; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(var(--rgb-well), 0.5);
  color: var(--cream); font: inherit; font-weight: 800; font-size: 13.5px; }
.wk-tabs button.on { background: linear-gradient(180deg, var(--tab-1), var(--tab-2)); color: #fff; border-color: var(--gold); }
.wk-tabs-s button { padding: 3px 10px; font-size: 12.5px; }
/* v7 §5: عالم الترتيب (أكثر من عالم ظاهر) — بطاقة لكل عالم، عالم الطلب مختار */
.wk-worlds { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 0 0 10px; }
.wk-wl { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--gold); flex: none; }
.wk-w { display: flex; flex-direction: column; gap: 1px; min-width: 0; max-width: 100%; padding: 7px 14px; border-radius: 14px; text-decoration: none;
  color: var(--cream); background: rgba(var(--rgb-well), 0.5); border: 1px solid var(--line); transition: border-color .15s, background .15s; }
.wk-w b { font-family: var(--title); font-size: 16px; line-height: 1.3; color: var(--gold-hi); overflow-wrap: anywhere; }
.wk-w small { color: var(--muted); font-weight: 700; font-size: 12.5px; line-height: 1.5; }
.wk-w .wk-nb { white-space: nowrap; }   /* (كل جزء لا ينكسر في وسطه: «متبقٍ 29 يوماً و23 ساعة») */
.wk-w:hover { border-color: var(--gold); color: var(--cream); text-decoration: none; }
.wk-w:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.wk-w.on { background: linear-gradient(180deg, var(--tab-1), var(--tab-2)); border-color: var(--gold); box-shadow: 0 0 0 1px rgba(var(--rgb-glow), 0.45); }
.wk-w.on small { color: var(--cream); }
.wk-w.st-ended { opacity: 0.85; }
.wk-arch { list-style: none; margin: 0; padding: 0; }
.wk-arch li { margin: 0 0 10px; }
.wk-arch details { border-radius: 12px; background: rgba(var(--rgb-well), 0.42); border: 1px solid var(--line-soft); padding: 10px 14px; }
.wk-arch summary { cursor: pointer; }
.wk-arch-top { margin-top: 8px; }
.wk-foot { text-align: center; padding: 18px 16px 30px; color: var(--muted); }

/* ---------------------------------------------------------------- الهاتف واللوح */
@media (max-width: 900px) {
  .wk-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 12px 10px 30px; }
  .wk-toc { position: static; max-height: none; padding: 6px 8px; }
  .wk-toc summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 800; color: var(--gold); padding: 4px 6px; }
  .wk-toc ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px; margin-top: 4px; }
  .wk-head { position: relative; }
  .wk-head-in { padding: 6px 10px; gap: 8px; }
  .wk-search { order: 5; flex-basis: 100%; }
  .wk-brand b { font-size: 16px; }
  .wk-sec { padding: 14px 12px 14px; }
  .wk-sec h2 { font-size: 21px; }
  .wk-grid, .wk-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .wk-grid-s { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .wk-ltbl { min-width: 0; }
  .wk-w { flex: 1 1 100%; padding: 6px 12px; }
  .wk-wl { flex-basis: 100%; }
  .wk-ltbl .c-tribe { display: none; }
  .wk-ltbl th, .wk-ltbl td { padding: 6px 6px; }
}
@media (max-width: 380px) {
  .wk-ltbl .c-vil { display: none; }
}
@media (max-width: 480px) {
  .wk-tools { gap: 6px; }
  .wk-play { display: none; }
  .wk-online { font-size: 11.5px; }
  html.wiki body { font-size: 14px; }
}
