:root {
  --bg: #08080c;
  --panel: #101017;
  --panel-2: #14141d;
  --line: rgba(255, 255, 255, .07);
  --text: #e8e8ef;
  --muted: #8b8b9a;
  --purple: #a855f7;
  --violet: #8b5cf6;
  --fuchsia: #d946ef;
  --amber: #f59e0b;
  --blue: #38bdf8;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 15% -10%, rgba(139, 92, 246, .16), transparent 60%),
              radial-gradient(900px 500px at 95% 0%, rgba(217, 70, 239, .10), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  /* ثلاث أعمدة: يسار (شنطة/فل/سكرابي) — SYNCHRONIZE في النص — يمين (الحسابات/إلغاء القفل).
     العمودان الجانبيان minmax(0,1fr) فالزرار الأوسط مابيتغطّيوش العناصر دي أبدًا. */
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 14px;
  padding: 12px 20px;
  background: rgba(8, 8, 12, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar-left { display: flex; align-items: center; gap: 14px; min-width: 0; overflow: hidden; }
.bar-right { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
@media (max-width: 1000px) {
  /* النوافذ الضيقة: SYNCHRONIZE بينزل في سطر لوحده تحت العمودين — بدل ما يتدهس
     فوق زرار سكرابي أو يقطع زرار CANCEL. */
  .topbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: auto; padding: 8px 18px; row-gap: 6px; }
  .sync-pill { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
}

.brand { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
/* علامة CM في أول الهيدر: نفس بلاطة أيقونة CMSync.exe (أوبسيدي + حلّة بنفسجى/فوشيا + نقطة كهرمانية). */
.cm-mark { display: inline-flex; align-items: center; flex: none; }
.cm-mark svg { width: 30px; height: 30px; display: block; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-left: 6px; vertical-align: super; }
.dot.off { background: var(--amber); }

.nav { display: flex; gap: 6px; margin-left: 18px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  background: transparent; color: var(--muted); border: 0; cursor: pointer;
  padding: 6px 10px; border-radius: 10px;
  font: inherit; font-weight: 700; font-size: 12px; letter-spacing: 2px;
}
.nav-item:hover { color: var(--text); background: var(--panel-2); }
.nav-item.active { color: #fff; background: rgba(139, 92, 246, .22); box-shadow: inset 0 0 0 1px rgba(168, 85, 247, .45); }
.ico { opacity: .9 }
.nav-ico { width: 26px; height: 26px; object-fit: contain; mix-blend-mode: screen; flex: none; }

.wallet { display: flex; gap: 14px; align-items: center; margin-left: 10px; }
.chip { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--muted); }
.chip img { width: 18px; height: 18px; object-fit: contain; }
.chip b { color: #fff; }
.level {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--amber); font-weight: 800; font-size: 12px;
}

.spacer { flex: 1; }

.accounts { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.acc {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 800; letter-spacing: 1.5px;
  padding: 7px 12px; border-radius: 8px;
}
.acc:hover { color: var(--text); }
.acc.on { background: rgba(139, 92, 246, .25); color: #fff; box-shadow: inset 0 0 0 1px rgba(168, 85, 247, .5); }

.pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 14px; cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 800; letter-spacing: 1.5px;
}
.pill:hover { border-color: rgba(168, 85, 247, .5); }
.pill[disabled] { opacity: .5; cursor: progress; }

/* SCRAPPY — زرار فوق جنب الفل: بيعرض آخر قراءة، والضغطة بتقرأ من البوابة الأول */
.scr-pill { padding: 5px 9px; }
.scr-pill.ready { border-color: rgba(168, 85, 247, .75); background: rgba(139, 92, 246, .2); box-shadow: 0 0 16px rgba(148, 90, 242, .25); }
/*SCRAPPY_LIVE=false: الشكل ثابت (نبض ولا توهج) — الديك رمادي وممنوع الضغط.
  التعتيب سايبه لقاعدة .pill[disabled] في phase10.css عشان تتحكم فيه لوحدها. */
.scr-pill.off, .scr-pill.off:hover { border-color: rgba(148, 163, 184, .3); background: transparent; box-shadow: none; }
.scr-pill.off[disabled] { cursor: not-allowed; }
.scr-pill.off .nav-ico { filter: grayscale(1); }

.mode-banner {
  margin: 14px 20px 0; padding: 10px 14px; border-radius: 10px;
  background: rgba(245, 158, 11, .12); border: 1px solid rgba(245, 158, 11, .35);
  color: #fcd9a1; font-size: 12.5px; font-weight: 600;
}

.layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; padding: 16px 20px 40px; align-items: start; }
.layout.single { grid-template-columns: 1fr; }
.side { display: grid; gap: 16px; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; min-width: 0;
}
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 13px; letter-spacing: 3px; font-weight: 800; }
.bar { width: 3px; height: 16px; border-radius: 2px; background: var(--muted); }
.bar.purple { background: var(--purple); }
.bar.amber { background: var(--amber); }
.bar.blue { background: var(--blue); }
.bar.green { background: var(--green); }
.count { color: var(--muted); font-size: 12px; font-weight: 700; }

.ghost {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 11px; font-weight: 800; letter-spacing: 1.2px;
  cursor: pointer;
}
.ghost:hover { color: var(--text); }
.toggle.on { color: #fff; border-color: rgba(168, 85, 247, .55); background: rgba(139, 92, 246, .18); }

.search-row { margin: 14px 0 6px; }
#f-search {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); padding: 11px 14px; font: inherit; letter-spacing: 1px;
}
#f-search:focus { outline: none; border-color: rgba(168, 85, 247, .6); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px; margin-top: 14px;
}

.card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; cursor: default; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover { transform: translateY(-2px); }
.thumb {
  aspect-ratio: 1 / 1; border-radius: 10px; background: #0c0c12;
  display: grid; place-items: center; border: 1px solid var(--line);
  position: relative;
}
.thumb img { max-width: 86%; max-height: 86%; object-fit: contain; }
.qty {
  position: absolute; right: 4px; bottom: 2px;
  background: rgba(0, 0, 0, .72); border-radius: 6px; padding: 1px 6px;
  font-size: 12px; font-weight: 800;
}
.lvl {
  position: absolute; left: 5px; bottom: 2px;
  font-size: 11px; font-weight: 800; color: #cbd5e1;
}
.name { font-weight: 800; font-size: 12.5px; line-height: 1.25; word-break: break-word; }
.label { font-size: 9.5px; letter-spacing: 1.1px; color: var(--muted); font-weight: 800; text-transform: uppercase; }
.meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.meta b { color: var(--text); }

/* ألوان الندرة = ألوان اللعبة نفسها (نفس اللي في الموقع المرجعي) */
.r-Common .thumb { border-color: rgba(156, 163, 175, .5); }
.r-Uncommon .thumb { border-color: rgba(76, 201, 79, .7); }
.r-Rare .thumb { border-color: rgba(15, 162, 224, .8); }
.r-Epic .thumb { border-color: rgba(164, 77, 224, .8); }
.r-Legendary .thumb { border-color: rgba(245, 158, 11, .85); }
.r-Amplified .thumb { border-color: rgba(255, 77, 46, .9); }
.r-Epic .name { color: #ebd6ff; }
.r-Legendary .name { color: #fde68a; }
.r-Amplified .name { color: #ffb3a3; }

.empty, .note { color: var(--muted); padding: 26px 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin-top: 12px; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-weight: 700; }
.ok { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); }
.legend { display: grid; gap: 6px; margin-top: 12px; font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }

/* ================= بطاقة العنصر العائمة (نفس بطاقة الموقع) ================= */
.item-card {
  position: fixed; left: 0; top: 0; z-index: 100000; width: 340px; max-width: calc(100vw - 28px); box-sizing: border-box; pointer-events: none;
  will-change: transform;
  background: #121518;
  border: 1px solid #343a40; border-top: 2px solid var(--card-accent, #7b8791); border-radius: 10px; padding: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  color: #edf0f2;
}
@keyframes card-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.ic-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ic-id { min-width: 0; }
.ic-name {
  margin: 0; font-size: 20px; line-height: 1.25; font-weight: 750;
  letter-spacing: -.3px; color: #f5f6f7; overflow-wrap: anywhere;
}
.ic-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 0; font-size: 11px; line-height: 1.4; font-weight: 600; letter-spacing: .35px; }
.ic-type { color: #a4adb5; }
.ic-side { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.ic-total { display: flex; align-items: center; }
.ic-total span { font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.6px; color: rgba(255, 255, 255, .2); margin-right: 4px; }
.ic-total b { font-size: 11px; font-weight: 900; color: rgba(255, 255, 255, .4); letter-spacing: -.3px; }
.ic-value { display: flex; align-items: center; margin-top: 4px; }
.ic-coin { width: 14px; height: 14px; color: rgba(255, 255, 255, .4); margin-right: 6px; }
.ic-value b { font-size: 11px; font-weight: 900; color: #fff; letter-spacing: -.3px; }
.ic-sec { margin-top: 12px; padding-top: 10px; border-top: 1px solid #2a3035; }
.ic-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ic-label { font-size: 10px; line-height: 1.5; font-weight: 650; text-transform: uppercase; letter-spacing: .8px; color: #a5afb8; }
.ic-count { font-size: 11px; font-weight: 600; color: #c4cbd1; }
.ic-dura { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: #e2e7eb; font-variant-numeric: tabular-nums; }
.ic-dura.is-yellow { color: #facc15; }
.ic-dura.is-red { color: #f87171; }
.ic-warn { width: 12px; height: 12px; flex-shrink: 0; }
.ic-dura.is-yellow .ic-warn { color: #eab308; }
.ic-dura.is-red .ic-warn { color: #ef4444; }
.ic-atts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.ic-att {
  position: relative; aspect-ratio: 1 / 1; border-radius: 6px; overflow: hidden;
  background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .06);
  display: flex; align-items: center; justify-content: center;
}
.ic-att img { width: 88%; height: 88%; object-fit: contain; }
.ic-att.empty { border-style: dashed; border-color: rgba(255, 255, 255, .08); }
/* مرفقات كارت العنصر بتلبس لون درجتها — نفس متغيرات --arc-* بتاعة البلاطات */
.ic-att:not(.empty) {
  border-color: var(--arc-r, rgba(255, 255, 255, .06));
  background-color: rgba(255, 255, 255, .03);
  background-image: var(--arc-card, none);
  box-shadow: inset 0 0 12px var(--arc-glow, transparent);
}
.ic-att:not(.empty) img { filter: drop-shadow(0 1px 4px var(--arc-glow, transparent)); }
/* خانة مرفق مالهاش أيقونة: الاسم المختصر بدل خانة فاضية */
.ic-att-word {
  padding: 0 4px; font-size: 10px; line-height: 1.15; text-align: center;
  color: #cfd6cd; letter-spacing: .02em; word-break: break-word;
}
/* الستينسل لون تجميلي: بيتعرض بس ومش بيتفك، فبياخد شكل مختلف عن خانات المرفقات */
.ic-stencils { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ic-stencil {
  display: flex; align-items: center; gap: 6px; padding: 3px 8px 3px 4px; border-radius: 6px;
  border: 1px dashed var(--arc-r, rgba(255, 255, 255, .12));
  background: rgba(255, 255, 255, .02); max-width: 100%;
}
.ic-stencil img { width: 22px; height: 22px; object-fit: contain; opacity: .9; }
.ic-stencil-name { font-size: 11px; color: #cfd6cd; letter-spacing: .02em; }
.ic-stencil .ic-stencil-name::after { content: " · stencil"; color: #7f8a80; font-size: 10px; }
.item-card.is-special { width: 340px; }
.ic-badges { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ic-badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 8px;
  border-radius: 6px; font-size: 9px; font-weight: 900;
  letter-spacing: 1.4px; text-transform: uppercase; text-shadow: none;
}
.ic-compat {
  margin-top: 14px; padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .06);
  display: flex; flex-direction: column; gap: 5px;
}
.ic-compat-list { font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .82); line-height: 1.45; }
.ic-desc {
  margin-top: 12px; padding: 0;
  display: flex; flex-direction: column; gap: 5px;
}
.ic-desc-text { font-size: 12px; font-weight: 400; color: #b8c0c7; line-height: 1.6; }
.ic-specs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 5px; }
.ic-specs > span {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, .035);
  font-size: 12px; line-height: 1.45; font-weight: 400;
  color: #aeb8c1;
}
.ic-specs > span:last-child { border-bottom: 0; }
.ic-specs b { max-width: 58%; font-size: 12px; line-height: 1.45; font-weight: 600; color: #edf1f4; text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ic-modifiers .ic-specs b { color: #a8d7ad; }
.ic-durability-track { height: 4px; margin-top: 8px; border-radius: 2px; background: #30363c; overflow: hidden; }
.ic-durability-track i { display: block; height: 100%; background: #bac7ce; }
.ic-durability-track.is-yellow i { background: #e3bb64; }
.ic-durability-track.is-red i { background: #e68181; }
.ic-recycle { margin-top: 12px; padding-top: 10px; border-top: 1px solid #2a3035; }
.ic-recycle-items { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ic-recycle-item { position: relative; display: flex; align-items: center; justify-content: center; width: 54px; min-height: 52px; padding: 4px; box-sizing: border-box; border: 1px solid #384148; border-radius: 6px; background: #1d2328; }
.ic-recycle-item img { width: 38px; height: 38px; object-fit: contain; }
.ic-recycle-item b { position: absolute; right: 3px; bottom: 2px; padding: 0 3px; border-radius: 3px; background: #121518; color: #edf1f4; font-size: 11px; line-height: 16px; font-variant-numeric: tabular-nums; }
.ic-recycle-item span { font-size: 10px; overflow-wrap: anywhere; padding-bottom: 12px; }
.ic-mats { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ic-mat {
  display: flex; align-items: center; gap: 9px; padding: 5px 7px;
  border-radius: 8px; background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .05);
}
.ic-mat-ico {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 5px;
  background: rgba(255, 255, 255, .04); display: flex; align-items: center; justify-content: center;
}
.ic-mat-ico img { width: 90%; height: 90%; object-fit: contain; }
.ic-mat-name { flex: 1; min-width: 0; font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, .85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-mat-qty { font-size: 11px; font-weight: 900; letter-spacing: -.2px; flex-shrink: 0; }
.ic-mat-qty.ok { color: #22c55e; }
.ic-mat-qty.bad { color: #ff4d4d; }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .wallet { display: none; }
  .rail { display: none; }
  .columns-host { padding-right: 0; }
}

/* ================= لوحة الإدارة: أعمدة + بلاطات + قوائم + الدرج ================= */
.hint-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 20px; font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line); background: rgba(16,16,23,.55);
}
.hint-bar .grow { flex: 1; }
.grow { flex: 1; }
.tiny { font-size: 9px !important; padding: 5px 9px !important; }

.columns { padding: 14px 16px 40px; }
.columns-host { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-right: 330px; padding-bottom: 8px; }

.col {
  flex: 1 1 360px; min-width: 340px; max-width: 520px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.col-head h2 { margin: 0; font-size: 12px; letter-spacing: 3px; font-weight: 800; }
.col-head .cap { font-size: 11px; color: var(--muted); font-weight: 700; }
.col-search {
  width: 100%; margin-top: 8px; padding: 8px 10px; font-size: 10px; letter-spacing: 1.4px;
  color: var(--text); background: #0a0a10; border: 1px solid var(--line); border-radius: 9px; outline: none;
}
.col-search:focus { border-color: rgba(168, 85, 247, .5); }
.col-body {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: 12px; max-height: 68vh; overflow-y: auto; min-height: 140px;
}
.col-body.drop { outline: 2px dashed rgba(168, 85, 247, .7); outline-offset: -6px; background: rgba(139, 92, 246, .07); }
.empty-col { grid-column: 1 / -1; }

/* Rampart tile: 16px corners, 2px rarity border, soft bottom radial glow */
.tile {
  --arc-r: #788091;
  --arc-b: #788091;
  --arc-glow: rgba(120, 128, 145, .22);
  --arc-card: radial-gradient(85% 65% at 50% 100%, var(--arc-glow) 0%, #11121a 75%);
  position: relative; aspect-ratio: 1 / 1; border-radius: 16px; cursor: grab; overflow: hidden;
  padding: clamp(6px, .6vw, 14px); background: var(--arc-card);
  border: 2px solid var(--arc-b);
  display: flex; align-items: center; justify-content: center;
  transition: all .16s ease;
}
.tile:hover {
  transform: translateY(-2px); border-color: var(--arc-r);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
}
.tile img {
  max-width: 78%; max-height: 78%; object-fit: contain; position: relative; z-index: 1;
}
.tile.broken img { opacity: .75; }
.tile .ph { color: var(--muted); font-size: 20px; position: relative; z-index: 1; }
.tile .qty, .tile .lvl {
  position: absolute; z-index: 3;
  background: rgba(10, 11, 16, .72);
  border-radius: 6px; padding: 2px 6px;
  color: #f1f5f9; font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.35; pointer-events: none;
  backdrop-filter: blur(4px);
}
.tile .qty { right: clamp(4px, .7vw, 10px); bottom: clamp(4px, .6vw, 8px); font-size: clamp(9px, .75vw, 12px); }
.tile .lvl { left: clamp(4px, .7vw, 10px); top: clamp(4px, .6vw, 8px); right: auto; bottom: auto; font-size: clamp(8px, .65vw, 10px); letter-spacing: .5px; color: #d7dbe4; }
/* قطعك المكررة بنفس الـ id — بتترسم تحت الستاش وقت البحث، بلاطات حية بتتسحب */
.xacc-results {
  grid-column: 1 / -1; display: grid; gap: clamp(6px, .6vw, 10px);
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  margin-top: 6px; border-top: 1px dashed rgba(239, 68, 68, .45); padding-top: 10px;
}
.xacc-head {
  grid-column: 1 / -1; margin: 0;
  font-size: 9px; font-weight: 900; letter-spacing: 1.4px; color: #fca5a5;
}
/* نفس الـ instance id موجود في حسابات تانية — شريط علوي فوق البلاطة فيه عدد كل حساب */
.tile .xacc-chips {
  position: absolute; z-index: 4; top: clamp(2px, .35vw, 5px); left: 5%; right: 5%;
  display: flex; flex-wrap: wrap; gap: 2px; justify-content: center;
  pointer-events: none;
}
.tile .xacc-chip {
  background: rgba(88, 28, 135, .62); border: 1px solid rgba(168, 85, 247, .55);
  border-radius: 6px; padding: 1px 4px; color: #e9d5ff;
  font-weight: 800; letter-spacing: .3px;
  font-size: clamp(7px, .55vw, 9.5px); line-height: 1.35;
}
.tile:has(.xacc-chips) .lvl { top: calc(clamp(4px, .6vw, 8px) + 17px); }
.tile:has(.xacc-chips) .warn { top: calc(8px + 17px); }
/* FIND ME — كمية النوع ده في كل حساب تاني: سطر باسم الحساب فوق بلاطاته. عرض بس. */
.findme {
  grid-column: 1 / -1; display: grid; gap: clamp(6px, .55vw, 9px);
  margin-top: 8px; border-top: 1px dashed rgba(224, 182, 74, .45); padding-top: 10px;
}
.findme-head {
  grid-column: 1 / -1; margin: 0;
  font-size: 9px; font-weight: 900; letter-spacing: 1.4px; color: #e0b64a;
}
.fm-grp { display: grid; gap: 5px; grid-column: 1 / -1; }
.fm-acc {
  display: flex; align-items: baseline; gap: 7px; margin: 0;
  font-size: 10.5px; font-weight: 900; letter-spacing: .5px; color: #e9d5ff;
}
.fm-acc .fm-count { font-size: 9px; font-weight: 700; letter-spacing: .3px; color: var(--muted); }
.fm-row {
  display: grid; gap: clamp(6px, .55vw, 9px);
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.tile.cat.fm { outline-color: rgba(224, 182, 74, .6); }
.tile.cat.fm img { max-width: 70%; max-height: 62%; }
/* الصحة: رقم عادي من غير صندوق — ظل خفيف كفاية للقراءة فوق الأيقونة */
.tile .dura {
  position: absolute; z-index: 3;
  left: clamp(4px, .7vw, 10px); bottom: clamp(3px, .5vw, 7px);
  color: #eef2f8; font-weight: 800; font-variant-numeric: tabular-nums;
  font-size: clamp(9px, .72vw, 11.5px); letter-spacing: .2px; line-height: 1.2;
  pointer-events: none;
}
.tile .dura-yellow { color: #f5b041; }
.tile .dura-red { color: #ff4d4d; }
.tile .warn {
  position: absolute; right: 10px; top: 8px; font-size: 10px; z-index: 4;
  color: var(--amber);
  background: rgba(10, 11, 16, .72); border-radius: 6px; padding: 2px 6px;
  backdrop-filter: blur(4px);
}
.tile .warn-yellow { color: #f5b041; font-size: 11px; }
.tile .warn-red { color: #ff4d4d; font-size: 11px; }

/* Blueprints & Designs: Rampart navy grid + vignette, neutral frame */
.tile.bp {
  background-color: #080d1a;
  background-image:
    radial-gradient(circle at 35% 55%, rgba(26, 68, 148, .55) 0%, rgba(10, 22, 54, .75) 55%, rgba(7, 9, 16, .96) 100%),
    linear-gradient(to right, rgba(65, 130, 235, .22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(65, 130, 235, .22) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px;
  background-position: center center;
  border: 1.5px solid #484c5a !important;
  box-shadow: inset 0 0 18px rgba(5, 8, 15, .85);
}
.tile.bp:hover {
  box-shadow: inset 0 0 18px rgba(5, 8, 15, .85), 0 6px 16px rgba(0, 0, 0, .45);
}
.tile.bp img { filter: none; }

/* Designs: charcoal + subtle crosshair pattern + rarity corner glow */
.tile.design {
  background-color: #181a22;
  background-image:
    linear-gradient(45deg, var(--arc-r) 0%, var(--arc-glow) 28%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M10 6.5v7M6.5 10h7' fill='none' stroke='%23ffffff' stroke-opacity='.08' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 100% 100%, 20px 20px;
  background-position: center center, 0 0;
  border: 1.5px solid var(--arc-r);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .5), inset 0 0 16px var(--arc-glow);
}
/* Stencils: clean dark card, no pattern */
.tile.stencil {
  background-color: #14161e;
  background-image: linear-gradient(45deg, var(--arc-r) 0%, var(--arc-glow) 28%, transparent 55%);
  background-size: 100% 100%;
  background-position: center center;
  border: 1.5px solid var(--arc-r);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .5), inset 0 0 16px var(--arc-glow);
}
.tile.design:hover, .tile.stencil:hover {
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .5), inset 0 0 16px var(--arc-glow),
              0 6px 16px rgba(0, 0, 0, .45);
}
.tile.design img, .tile.stencil img { transform: translateY(-6px); }
.tile .cat-strip {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 22px;
  display: flex; align-items: center; gap: 5px; padding: 0 8px;
  background: rgba(11, 12, 16, .9); border-top: 1px solid rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .82); font-size: 8.5px; font-weight: 900;
  letter-spacing: 1.5px; text-transform: uppercase; pointer-events: none;
}
.tile .cat-strip svg { flex-shrink: 0; opacity: .9; }
.tile.design .qty, .tile.stencil .qty {
  right: 7px; bottom: 3px; background: transparent; padding: 0;
  backdrop-filter: none; font-size: 10.5px; color: #e5e7eb;
}
.r-Common {
  --arc-r: #788091; --arc-b: #788091; --arc-glow: rgba(120, 128, 145, .22);
  --arc-card: radial-gradient(85% 65% at 50% 100%, var(--arc-glow) 0%, #11121a 75%);
}
.r-Uncommon {
  --arc-r: #4cc94f; --arc-b: #4cc94f; --arc-glow: rgba(76, 201, 79, .26);
  --arc-card: radial-gradient(85% 65% at 50% 100%, var(--arc-glow) 0%, #11121a 75%);
}
.r-Rare {
  --arc-r: #0fa2e0; --arc-b: #0fa2e0; --arc-glow: rgba(15, 162, 224, .28);
  --arc-card: radial-gradient(85% 65% at 50% 100%, var(--arc-glow) 0%, #11121a 75%);
}
.r-Epic {
  --arc-r: #a44de0; --arc-b: #a44de0; --arc-glow: rgba(164, 77, 224, .28);
  --arc-card: radial-gradient(85% 65% at 50% 100%, var(--arc-glow) 0%, #11121a 75%);
}
.r-Legendary {
  --arc-r: #f5b800; --arc-b: #f5b800; --arc-glow: rgba(245, 184, 0, .28);
  --arc-card: radial-gradient(85% 65% at 50% 100%, var(--arc-glow) 0%, #11121a 75%);
}
.r-Amplified {
  --arc-r: #ff4d2e; --arc-b: #ff4d2e; --arc-glow: rgba(255, 77, 46, .3);
  --arc-card: radial-gradient(85% 65% at 50% 100%, var(--arc-glow) 0%, #11121a 75%);
}
body.dragging .tile { cursor: grabbing; }
/* أثناء السحب: بلاطات الستاش/الشنطة مالهاش أي hover ولا transition. المتصفح كان
   بيرسم ظل + transform لكل بلاطة بيعدي عليها الماوس، فالستاش المليان كان بيقطّع.
   pointer-events: none بتخلّي التقاط الـ dragover على الحاوية نفسها مش على 300
   بلاطة، واللي محتاج عناصر (بلاطة الوجهة اللي بتتقسم COMBINE/SWAP) بيرجع
   pointer-events: auto في قاعدته. */
body.dragging .inv-body .tile {
  pointer-events: none;
  transition: none;
}
body.dragging .inv-body .tile:hover {
  transform: none;
  box-shadow: none;
}
body.dragging .inv-body .tile.dnd-live { pointer-events: auto; }
/* نفس الـ pointer-events للبلاطة اللي بتتسحب أو للوجهة: ظل الماوس فوقها بيولّد
   hover + transition على كل حركة. */
body.dragging .tile.drag-src,
body.dragging .tile.dnd-combo,
body.dragging .tile.dnd-combine,
body.dragging .tile.dnd-swap { transition: none; }
/* بلاطة الوجهة بترسم فوق GPU بدل إعادة تخطيط الشجرة مع كل حركة ماوس. */
body.dragging .tile.dnd-combo,
body.dragging .tile.dnd-combine,
body.dragging .tile.dnd-swap,
body.dragging .tile.drag-src { will-change: transform; }

/* البلاطة "الميتة": للعرض بس — مفيش drag ولا selection (بتتعلّم في wireInventory بـ :not(.cat)) */
.tile.cat { cursor: default; outline: 1px dashed rgba(148, 163, 184, .55); outline-offset: -3px; }
.tile.cat:hover { transform: none; }
.tile.cat img { max-width: 62%; max-height: 58%; }

.rail { position: fixed; right: 16px; top: 108px; width: 300px; display: flex; flex-direction: column; gap: 12px; z-index: 15; }
.rail .panel { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.log { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.log-row { display: flex; flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.03); border-left: 2px solid var(--muted); }
.log-row.ok { border-left-color: var(--green); }
.log-row.bad { border-left-color: var(--red); }
.log-row span { color: var(--muted); }
.log-row em { color: #cbd5e1; font-style: normal; font-family: ui-monospace, Consolas, monospace; font-size: 9px; word-break: break-all; }

.write-chip { letter-spacing: 1.6px; }
.write-chip.off { color: var(--muted); border-color: rgba(255,255,255,.12); }
.write-chip.on { color: #fff; border-color: rgba(239,68,68,.7); background: rgba(239,68,68,.16); box-shadow: 0 0 18px rgba(239,68,68,.25); }

.ctx {
  position: fixed; z-index: 60; min-width: 190px; padding: 6px;
  background: rgba(13,15,18,.98); border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.9); display: flex; flex-direction: column; gap: 3px;
}
.ctx .ctx-title { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,.28); padding: 6px 8px 2px; }
.ctx button {
  text-align: left; padding: 7px 9px; font-size: 9px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: rgba(255,255,255,.8); background: transparent; border: 0; border-radius: 8px; cursor: pointer;
}
.ctx button:hover:not(:disabled) { background: rgba(255,255,255,.09); color: #fff; }
.ctx button:disabled { opacity: .35; cursor: not-allowed; }

.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 380px; z-index: 70;
  background: rgba(10,10,15,.98); border-left: 1px solid var(--line); backdrop-filter: blur(14px);
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 14px; font-weight: 800; flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.drawer-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.d-hero { height: 150px; border-radius: 12px; border: 2px solid rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.03); }
.d-hero img { max-height: 130px; }
.d-label { margin: 10px 0 12px; font-size: 10px; letter-spacing: 2px; color: var(--muted); font-weight: 800; }
.d-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.d-table td { padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.05); }
.d-table td:first-child { color: var(--muted); letter-spacing: 1px; font-size: 9px; font-weight: 800; width: 40%; }
.d-mats { display: flex; flex-wrap: wrap; gap: 3px 9px; }
.d-mat { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.d-mat img { width: 18px; height: 18px; border-radius: 5px; object-fit: contain; }
.d-mat b { color: #34d399; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 9px; word-break: break-all; }
.condbar { display: inline-block; width: 90px; height: 6px; border-radius: 4px; background: rgba(255,255,255,.1); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.condbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--amber), var(--green)); }
.tag { font-size: 8px; letter-spacing: 1.4px; font-weight: 800; padding: 2px 6px; border-radius: 6px; }
.tag.bad { color: #fecaca; background: rgba(239,68,68,.18); }

.modal { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card { width: min(680px, 100%); max-height: 84vh; overflow-y: auto; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.modal-card h3 { margin: 0 0 12px; font-size: 13px; letter-spacing: 2px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.pill.primary { color: #fff; border-color: rgba(168,85,247,.6); background: rgba(139,92,246,.22); }
.pill.danger { color: #fff; border-color: rgba(239,68,68,.6); background: rgba(239,68,68,.24); }
.confirm-list { list-style: none; margin: 10px 0; padding: 0; max-height: 220px; overflow-y: auto; }
.confirm-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
  padding: 6px 10px; border-radius: 10px; font-size: 12px;
  background: rgba(255,255,255,.03); border: 1px solid var(--line); margin-bottom: 6px;
}
.confirm-list li b { color: var(--gold, #e0b64a); font-variant-numeric: tabular-nums; }
.confirm-list li .where {
  flex: 1 0 100%; font-style: normal; font-size: 10px; letter-spacing: .4px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.confirm-total { margin: 10px 0 0; font-size: 13px; }
.confirm-total b { color: var(--gold, #e0b64a); font-variant-numeric: tabular-nums; }

.upg-levels { display: flex; gap: 6px; margin: 0 0 14px; flex-wrap: wrap; }
.upg-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 62px;
  padding: 7px 10px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer;
  background: rgba(255,255,255,.03); color: inherit; font-size: 12px; font-weight: 600; }
.upg-chip i { font-style: normal; font-size: 9px; font-weight: 400; color: #94a3b8; }
.upg-chip.sel { border-color: var(--gold, #e0b64a); background: rgba(224,182,74,.14); color: var(--gold, #e0b64a); }
.upg-chip.now { border-color: rgba(52,211,153,.55); color: #34d399; }
.upg-chip.past { opacity: .32; }
.upg-chip[disabled] { cursor: default; }
.upg-tier { position: absolute; left: 4px; bottom: 1px; font-size: 10px; font-weight: 900;
  letter-spacing: .5px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.upg-rar { flex: 0 0 auto; font-size: 9.5px; font-weight: 800; letter-spacing: .12em; color: var(--arc-r, #94a3b8); }
.rec-mat.miss .rec-mat-qty { color: #f87171; }
.upg-go { flex: 1 1 220px; border: 0; border-radius: 999px; cursor: pointer;
  padding: 13px 18px; font: inherit; font-size: 13px; font-weight: 800; letter-spacing: .07em;
  color: #1a1408; background: linear-gradient(180deg, #ffd257, #f0b429); }
.upg-go[disabled] { opacity: .35; cursor: default; }

/* إعادة التدوير: بلاطة مورد لكل خامة — شبه نافذة اللعبة */
.rec-lead { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: #cbd5e1; }
.rec-lead b { color: #fff; }
.rec-note { margin: 0 0 10px; font-size: 11.5px; color: #94a3b8; }
.rec-mats { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 9px; }
.rec-mat { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rec-mat-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--arc-b, var(--line)); background: var(--arc-card, rgba(255,255,255,.05));
  display: flex; align-items: center; justify-content: center; color: var(--arc-r, #94a3b8); }
.rec-mat-tile img { width: 76%; height: 76%; object-fit: contain; }
.rec-mat-wrench { position: absolute; left: 5px; bottom: 4px; opacity: .8; }
.rec-mat-qty { position: absolute; right: 6px; bottom: 3px; font-size: 11px; font-weight: 700;
  color: #e5e7eb; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.rec-mat-name { font-size: 10.5px; line-height: 1.2; color: #cbd5e1; text-align: center;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rec-foot { position: sticky; bottom: -20px; z-index: 2; display: flex; align-items: center; gap: 10px;
  margin: 14px -20px -20px; padding: 11px 20px; flex-wrap: wrap;
  background: var(--panel); border-top: 1px solid var(--line); }
.rec-foot .pill[disabled] { opacity: .35; pointer-events: none; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 10px; color: #cbd5e1; background: #0a0a10; border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 26px; z-index: 95;
  padding: 11px 18px; border-radius: 12px; font-size: 12px; font-weight: 700;
  background: rgba(16,16,23,.97); border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(0,0,0,.6);
}
.toast.ok { border-color: rgba(34,197,94,.5); color: #bbf7d0; }
.toast.bad { border-color: rgba(239,68,68,.5); color: #fecaca; }



/* ---------- queued moves: plans waiting for Embark to reopen the write route ---------- */
.queue-wrap { position: relative; display: flex; }
.queue-pill { padding: 8px 12px; gap: 7px; border-color: rgba(245, 158, 11, .55); background: rgba(245, 158, 11, .16); }
.queue-pill:hover { border-color: rgba(245, 158, 11, .8); }
.queue-ico { font-size: 13px; line-height: 1; }
#queue-count { font-size: 12px; font-weight: 900; }
.queue-pop {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 70; width: 330px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .55); padding: 11px 12px;
}
.q-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 900; letter-spacing: 1.3px; }
.q-num { background: rgba(245, 158, 11, .2); color: var(--amber); border-radius: 8px; padding: 1px 8px; font-size: 11px; }
.q-note { margin: 7px 0 9px; font-size: 10.5px; line-height: 1.5; color: var(--muted); }
.q-list { display: grid; gap: 6px; max-height: 280px; overflow: auto; }
.q-row { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; }
.q-name { flex: 1; min-width: 0; font-size: 11px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-age { color: var(--muted); font-size: 10px; white-space: nowrap; }
.q-x { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 7px; width: 20px; height: 20px; cursor: pointer; font-size: 10px; line-height: 1; }
.q-x:hover { color: #fff; border-color: rgba(239, 68, 68, .7); background: rgba(239, 68, 68, .28); }
.q-foot { display: flex; gap: 8px; margin-top: 9px; }
.q-foot .pill { flex: 1; justify-content: center; padding: 7px 8px; font-size: 10px; letter-spacing: 1px; }


