/* Saqar Alkhaleej - Game Book. Dark warm "The Dive" look with thin gold lines (the game's own style). */
:root {
  --bg: #100A06;
  --bg2: #171009;
  --card: #1E150E;
  --card2: #261A11;
  --line: rgba(201, 162, 39, .35);
  --line-strong: #C9A227;
  --gold: #C9A227;
  --gold2: #F3D774;
  --text: #EFE6D2;
  --muted: #B3A386;
  --dim: #7E715C;
  --green: #6FBF5A;
  --yellow: #E8C547;
  --orange: #E08A3A;
  --red: #C9503D;
  --cyan: #6FD3E0;
  --female: #E58FB5;
  --male: #6FA8E5;
  --common: #A8A39A; --good: #6FBF5A; --rare: #4FA3E0; --elite: #B47CE8; --legendary: #F3B13A;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font-ar: "El Messiri", "Noto Kufi Arabic", system-ui, sans-serif;
  --font-en: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-title-en: "Cinzel", Georgia, serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-ar); font-size: 17px; line-height: 1.75;
  background-image: radial-gradient(ellipse 120% 60% at 50% -10%, #3A2614 0%, rgba(16, 10, 6, 0) 60%);
  background-attachment: fixed; overflow-x: hidden;
}
html[lang=en] body { font-family: var(--font-en); font-size: 16px; line-height: 1.65; }
a { color: var(--gold2); }
img { max-width: 100%; display: block; }
h1, h2, h3 { color: var(--gold2); line-height: 1.3; margin: 0 0 .5em; font-weight: 700; }
html[lang=en] h1, html[lang=en] h2 { font-family: var(--font-title-en); letter-spacing: .02em; }
h1 { font-size: clamp(28px, 6vw, 44px); }
h2 { font-size: clamp(22px, 4.4vw, 30px); }
h3 { font-size: 19px; color: var(--gold); margin-top: 1.4em; }
p { margin: .6em 0; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
b, strong { color: #FFF4D6; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: rgba(16, 10, 6, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.top .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--gold2); min-width: 0; }
.top .brand img { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--gold); }
.top .brand span { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .grow { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--gold); border-radius: 999px; background: var(--card); color: var(--gold2); font: inherit; font-size: 15px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--card2); }
.btn.icon { width: 40px; padding: 0; }
.search { position: relative; flex: 0 1 260px; }
.search input {
  width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 0 16px; font: inherit; font-size: 15px; outline: none;
}
.search input:focus { border-color: var(--gold); }
.results {
  position: absolute; top: 46px; inset-inline: 0; min-width: 280px; max-height: 60vh; overflow: auto; background: var(--card);
  border: 1px solid var(--gold); border-radius: 14px; box-shadow: var(--shadow); display: none; z-index: 60;
}
.results.on { display: block; }
.results a { display: block; padding: 10px 14px; text-decoration: none; color: var(--text); border-bottom: 1px solid rgba(201,162,39,.12); }
.results a small { display: block; color: var(--muted); }
.results a:hover { background: var(--card2); }

/* ---------- layout ---------- */
.wrap { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; max-width: 1320px; margin: 0 auto; padding: 24px 16px 80px; }
.side { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; padding-inline-end: 4px; }
.side a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0; border-radius: 12px; color: var(--muted);
  text-decoration: none; border: 1px solid transparent; font-size: 15px;
}
.side a img { width: 30px; height: 30px; flex: 0 0 30px; object-fit: contain; }
.side a:hover { color: var(--text); background: var(--card); }
.side a.on { color: var(--gold2); background: var(--card); border-color: var(--line); }
.side .label { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; margin: 14px 10px 4px; }
main { min-width: 0; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .wrap { grid-template-columns: minmax(0, 1fr); padding-top: 16px; }
  .side {
    position: fixed; top: 61px; bottom: 0; inset-inline-start: 0; width: min(320px, 86vw); max-height: none; z-index: 40;
    background: var(--bg2); border-inline-end: 1px solid var(--line); padding: 12px; transform: translateX(-105%); transition: transform .25s;
  }
  html[dir=rtl] .side { transform: translateX(105%); }
  body.menu-open .side { transform: none; }
  .menu-btn { display: inline-flex; }
  .search { flex: 1 1 auto; }
  .top .brand span { display: none; }
}

/* ---------- home ---------- */
.hero {
  position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); min-height: 320px;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); background: linear-gradient(135deg, #2A1B0F, #120B06);
}
.hero .txt { padding: clamp(22px, 4vw, 44px); align-self: center; }
.hero .txt p { color: var(--muted); font-size: 18px; }
.hero .pic { position: relative; min-height: 260px; }
.hero .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.hero .pic::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #1A1009 0%, rgba(26,16,9,0) 40%); }
html[dir=rtl] .hero .pic::after { background: linear-gradient(270deg, #1A1009 0%, rgba(26,16,9,0) 40%); }
@media (max-width: 700px) { .hero { grid-template-columns: 1fr; } .hero .pic { min-height: 220px; order: -1; } .hero .pic::after { background: linear-gradient(0deg, #1A1009 0%, rgba(26,16,9,0) 50%) !important; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--muted); background: rgba(0,0,0,.25); text-decoration: none; }
.chip.gold { color: var(--gold2); border-color: var(--gold); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 22px; }
.ccard {
  display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: transform .15s, border-color .15s;
}
.ccard:hover { transform: translateY(-2px); border-color: var(--gold); }
.ccard img { width: 54px; height: 54px; flex: 0 0 54px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.ccard b { display: block; color: var(--gold2); font-size: 17px; }
.ccard small { color: var(--muted); font-size: 14px; line-height: 1.5; display: block; }
.ccard .n { color: var(--dim); font-size: 12px; }

/* ---------- chapter ---------- */
.chead {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; padding: 22px; border-radius: 22px;
  background: linear-gradient(135deg, #2A1B0F, #140C07); border: 1px solid var(--line); margin-bottom: 18px;
}
.chead img { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0,0,0,.6)); }
.chead p { color: var(--muted); margin: 0; }
.toc { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; position: sticky; top: 61px; z-index: 5; background: linear-gradient(var(--bg) 70%, rgba(16,10,6,0)); scrollbar-width: thin; }
.toc a { flex: 0 0 auto; }
section.s { padding: 22px; margin: 16px 0; border-radius: var(--radius); background: rgba(30, 21, 14, .72); border: 1px solid rgba(201,162,39,.18); scroll-margin-top: 120px; }
section.s > h2 { display: flex; align-items: center; gap: 10px; }
section.s > h2::before { content: ""; width: 4px; height: 1em; border-radius: 4px; background: var(--gold); flex: 0 0 4px; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- content parts ---------- */
.tbl { overflow-x: auto; margin: 12px 0; border-radius: 12px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 9px 12px; text-align: start; border-bottom: 1px solid rgba(201,162,39,.14); vertical-align: top; }
th { background: #2A1D12; color: var(--gold2); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: rgba(255,255,255,.02); }
td.c, th.c { text-align: center; }
.call { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; margin: 14px 0; border: 1px solid; background: rgba(0,0,0,.25); }
.call::before { font-size: 22px; line-height: 1.2; }
.call.tip { border-color: rgba(111,191,90,.5); } .call.tip::before { content: "💡"; }
.call.next { border-color: rgba(111,211,224,.55); background: rgba(111,211,224,.06); } .call.next::before { content: "🆕"; }
.call.warn { border-color: rgba(224,138,58,.6); } .call.warn::before { content: "⚠️"; }
.call.info { border-color: var(--line); } .call.info::before { content: "📜"; }
.call > div { min-width: 0; }
.call b:first-child { display: block; margin-bottom: 2px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.kpi { padding: 14px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); text-align: center; }
.kpi .v { font-size: 28px; font-weight: 700; color: var(--gold2); line-height: 1.2; }
.kpi .l { font-size: 14px; color: var(--muted); line-height: 1.4; margin-top: 4px; }
.steps { counter-reset: st; list-style: none; padding: 0; margin: 12px 0; }
.steps li { counter-increment: st; position: relative; padding: 10px 14px; padding-inline-start: 52px; margin: 8px 0; background: rgba(0,0,0,.22); border-radius: 12px; border: 1px solid rgba(201,162,39,.15); }
.steps li::before { content: counter(st); position: absolute; inset-inline-start: 12px; top: 10px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #1E150E; font-weight: 700; font-size: 15px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.tag { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 13px; border: 1px solid currentColor; line-height: 1.6; }
.t-common { color: var(--common); } .t-good { color: var(--good); } .t-rare { color: var(--rare); } .t-elite { color: var(--elite); } .t-legendary { color: var(--legendary); }
.fem { color: var(--female); } .mal { color: var(--male); }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); vertical-align: middle; margin-inline-end: 4px; }

/* screenshots: a thin phone frame, both languages */
.shots { display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 12px; scroll-snap-type: x mandatory; }
.shot { flex: 0 0 auto; width: min(240px, 62vw); margin: 0; scroll-snap-align: start; }
.shot.wide { width: min(460px, 86vw); }
.shot .ph { border-radius: 22px; padding: 6px; background: linear-gradient(160deg, #3A2A18, #120B06); border: 1px solid var(--gold); box-shadow: var(--shadow); cursor: zoom-in; }
.shot img { border-radius: 16px; width: 100%; background: #000; aspect-ratio: auto; }
.shot figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 8px; line-height: 1.45; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.9); display: none; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox.on { display: grid; }
.lightbox img { max-height: 92vh; max-width: 96vw; border-radius: 16px; border: 1px solid var(--gold); }

/* ---------- widgets ---------- */
.w { margin: 16px 0; padding: 16px; border-radius: 16px; background: #150E08; border: 1px solid var(--gold); }
.w .wt { display: flex; align-items: center; gap: 8px; color: var(--gold2); font-weight: 700; margin-bottom: 10px; }
.w .wt::before { content: "⚙"; color: var(--gold); }
.w label { font-size: 14px; color: var(--muted); }
.w select, .w input[type=number] {
  height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 15px; padding: 0 8px;
}
.w input[type=number] { width: 70px; text-align: center; }
.w input[type=range] { width: 100%; accent-color: var(--gold); }
.seg { display: inline-flex; border: 1px solid var(--gold); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; padding: 6px 14px; cursor: pointer; }
.seg button.on { background: var(--gold); color: #1E150E; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 8px 0; }
.bars .b { display: grid; grid-template-columns: minmax(70px, 140px) minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.bars .track { height: 14px; border-radius: 8px; background: rgba(255,255,255,.06); position: relative; overflow: hidden; }
.bars .fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 8px; background: linear-gradient(90deg, #8A6A12, var(--gold2)); }
.bars .rng { position: absolute; inset-block: 0; border-radius: 8px; background: linear-gradient(90deg, #8A6A12, var(--gold2)); }
.bars .v { color: var(--gold2); font-variant-numeric: tabular-nums; direction: ltr; }
.hist { display: flex; align-items: flex-end; gap: 2px; height: 46px; direction: ltr; }
.hist i { flex: 1; background: var(--gold); border-radius: 2px 2px 0 0; min-height: 1px; opacity: .85; }
.hist i.par { background: var(--cyan); }
.breed-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.breed-out .o { padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.breed-out .o b { color: var(--gold2); }
.breed-out .o small { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
.parents { display: grid; grid-template-columns: auto repeat(2, minmax(0, 1fr)); gap: 6px 10px; align-items: center; max-width: 520px; }
.parents .h { font-size: 14px; text-align: center; }
.gene-grid { display: grid; grid-template-columns: auto repeat(2, minmax(0, 1fr)); gap: 6px; max-width: 460px; margin-top: 12px; }
.gene-grid div { padding: 8px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); text-align: center; font-size: 14px; }
.gene-grid .hd { background: transparent; border: 0; color: var(--muted); }
.gene-grid .white { border-color: #fff; box-shadow: 0 0 12px rgba(255,255,255,.35); }
.meter { position: relative; height: 46px; border-radius: 12px; overflow: hidden; display: flex; direction: ltr; border: 1px solid var(--gold); user-select: none; cursor: pointer; touch-action: manipulation; }
.meter span { height: 100%; }
.meter .needle { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 10px #fff; border-radius: 2px; }
.score { font-size: 32px; font-weight: 700; color: var(--gold2); }
.tierbar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; direction: ltr; margin: 8px 0 4px; position: relative; }
.tierbar span { height: 100%; }
.tierbar .mark { position: absolute; top: -4px; bottom: -4px; width: 3px; background: #fff; box-shadow: 0 0 8px #fff; }
.timeline { display: flex; gap: 0; align-items: stretch; overflow-x: auto; padding: 4px 0 8px; }
.timeline .tl { flex: 1 0 120px; text-align: center; position: relative; padding: 0 6px; }
.timeline .tl .dot { width: 44px; height: 44px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; background: var(--card2); border: 1px solid var(--gold); font-size: 20px; position: relative; z-index: 1; }
.timeline .tl::before { content: ""; position: absolute; top: 22px; inset-inline: 0; height: 2px; background: var(--line); }
.timeline .tl b { display: block; color: var(--gold2); font-size: 15px; }
.timeline .tl small { color: var(--muted); font-size: 13px; display: block; line-height: 1.45; }
.foot { text-align: center; color: var(--dim); font-size: 13px; margin-top: 40px; }
@media (max-width: 520px) { section.s { padding: 16px; } .chead { padding: 16px; } .chead img { width: 60px; height: 60px; } }
