/* صراع الأمم — تصميم للجوال أولاً. مظهر داكن واحد مقصود (غرفة عمليات عسكرية ليلية):
   كحلي عميق، ذهبي للأوامر، أحمر للعدو، أخضر للحلفاء. */
:root {
  color-scheme: dark;
  --bg: #050b18;
  --panel: rgba(10, 21, 42, 0.94);
  --panel-2: rgba(19, 36, 66, 0.97);
  --line: rgba(120, 170, 255, 0.2);
  --gold: #f4c542;
  --gold-2: #c8961e;
  --ink-on-gold: #2a1a00;
  --text: #e8eefc;
  --muted: #8fa3c7;
  --red: #ff5a5a;
  --green: #3ddc84;
  --blue: #4aa3ff;
  --violet: #b48cff;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  --radius: 14px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --left: env(safe-area-inset-left, 0px);
  --right: env(safe-area-inset-right, 0px);
  --nav-h: 62px;
  --font: 'Cairo', 'Segoe UI', Tahoma, 'Noto Sans Arabic', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; }
body { direction: rtl; }
button { font-family: inherit; color: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 16px; } /* 16px يمنع التكبير التلقائي في iOS */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

#globe { position: fixed; inset: 0; direction: ltr; touch-action: none; }
#globe .cm, #globe .globe-tip { direction: rtl; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.6) 100%); }

.btn { background: linear-gradient(180deg, #2a4a7f, #18315a); border: 1px solid #3e68a8; border-radius: 10px; padding: 9px 16px; min-height: 40px;
  font-weight: 700; font-size: 14px; white-space: nowrap; transition: filter .15s, transform .05s; }
.btn:active { transform: translateY(1px); filter: brightness(1.15); }
.btn.gold { background: linear-gradient(180deg, #ffd866, #c8961e); color: var(--ink-on-gold); border-color: #ffe08a; }
.btn.red { background: linear-gradient(180deg, #e04848, #8f1d1d); border-color: #ff7a7a; }
.btn.green { background: linear-gradient(180deg, #2fbf6b, #17703c); border-color: #5fe39a; }
.btn.sm { padding: 5px 12px; min-height: 34px; font-size: 13px; }
.btn:disabled { filter: grayscale(1) brightness(.6); cursor: not-allowed; }
.close { background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 50%; width: 36px; height: 36px; font-size: 16px; color: var(--muted); flex: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.muted { color: var(--muted); }
.sep { height: 1px; background: var(--line); margin: 12px 0; }
.badge { position: absolute; top: 2px; left: 50%; margin-left: 6px; background: var(--red); color: #fff; font-size: 10px; font-style: normal; border-radius: 9px; padding: 0 5px; min-width: 17px; line-height: 17px; text-align: center; }

/* ---------- الدخول ---------- */
.screen { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--top) + 16px) max(16px, var(--right)) calc(var(--bottom) + 16px) max(16px, var(--left));
  background: radial-gradient(ellipse at center, rgba(5, 12, 30, .3), rgba(0, 0, 0, .8)); }
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 24px 20px;
  box-shadow: var(--shadow); backdrop-filter: blur(8px); display: flex; flex-direction: column; gap: 12px; }
.logo { text-align: center; margin-bottom: 4px; }
.logo-emblem { width: 68px; height: 68px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; color: var(--ink-on-gold);
  background: radial-gradient(circle, #ffd866, #8a5d00); box-shadow: 0 0 30px rgba(244, 197, 66, .5); }
.logo h1 { margin: 0; font-size: 32px; font-weight: 900; color: var(--gold); text-shadow: 0 2px 12px rgba(244, 197, 66, .4); }
.logo p { margin: 4px 0 0; color: var(--muted); text-wrap: balance; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.auth-card input, .field { background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 16px; min-width: 0; }
.auth-error { color: var(--red); min-height: 20px; font-size: 13px; }
.auth-note { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- الشريط العلوي ---------- */
#topbar { position: fixed; top: 0; inset-inline: 0; z-index: 10; display: flex; align-items: center; gap: 6px;
  padding: calc(var(--top) + 6px) max(8px, var(--right)) 8px max(8px, var(--left));
  background: linear-gradient(180deg, rgba(4, 10, 24, .97), rgba(4, 10, 24, .75) 75%, transparent); }
.profile { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px; flex: none; max-width: 34%; }
.avatar { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; font-size: 16px; border: 2px solid var(--gold); flex: none; color: #fff; }
.pinfo { display: flex; flex-direction: column; text-align: right; min-width: 0; }
.pinfo b { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinfo small { font-size: 11px; color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptag { color: var(--gold); font-weight: 900; }
.resources { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; flex: 1; min-width: 0; }
.res { display: flex; align-items: center; gap: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px 4px; min-width: 0; }
.res .ri { width: 20px; height: 20px; flex: none; }
.res div { min-width: 0; }
.res b { display: block; font-size: 12px; line-height: 1.15; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.res small { color: var(--green); font-size: 9px; direction: ltr; display: block; text-align: right; white-space: nowrap; }
.res small.neg { color: var(--red); }
.res.full b { color: var(--red); }

#statusbar { position: fixed; top: calc(var(--top) + 58px); inset-inline: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none;
  padding: 0 max(8px, var(--right)) 0 max(8px, var(--left)); }
#protect { background: rgba(30, 120, 70, .85); border: 1px solid #5fe39a; border-radius: 20px; padding: 1px 12px; font-size: 11px; }
#marches-mini { display: flex; flex-direction: column; gap: 4px; width: min(420px, 100%); pointer-events: auto; }
.mm { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px 8px; font-size: 11px; }
.mm > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%; }
.mm .bar { flex: 1; height: 5px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; min-width: 30px; }
.mm .bar i { display: block; height: 100%; background: var(--gold); }
.mm .btn.sm { min-height: 26px; padding: 1px 8px; font-size: 11px; }
.mm.incoming { border-color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 14px rgba(255, 77, 77, .7); } }
#banner { position: fixed; top: calc(var(--top) + 64px); left: 50%; transform: translateX(-50%); z-index: 12; width: max-content; max-width: calc(100% - 32px);
  background: linear-gradient(90deg, #8a5d00, #f4c542, #8a5d00); color: var(--ink-on-gold); font-weight: 900; font-size: 15px; text-align: center;
  padding: 8px 20px; border-radius: 24px; box-shadow: 0 0 30px rgba(244, 197, 66, .6); pointer-events: none; }

/* ---------- أزرار الخريطة ---------- */
#mapctl { position: fixed; left: calc(var(--left) + 10px); bottom: calc(var(--bottom) + var(--nav-h) + 62px); z-index: 9; display: flex; flex-direction: column; gap: 8px; }
#mapctl button { width: 44px; height: 44px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); font-size: 20px; }

/* ---------- شريط الدردشة ---------- */
#chat-ticker { position: fixed; z-index: 9; bottom: calc(var(--bottom) + var(--nav-h) + 8px); right: calc(var(--right) + 10px); left: calc(var(--left) + 10px);
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; text-align: right; background: var(--panel); border: 1px solid var(--line); border-radius: 21px; }
#ticker-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
#chat-ticker .badge { position: static; margin: 0; }

/* ---------- الشريط السفلي ---------- */
#bottomnav { position: fixed; bottom: 0; inset-inline: 0; z-index: 11; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + var(--bottom)); padding: 0 max(4px, var(--right)) var(--bottom) max(4px, var(--left));
  background: rgba(6, 14, 30, .97); border-top: 1px solid var(--line); }
#bottomnav button { position: relative; background: none; border: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 11px; font-weight: 700; color: var(--muted); }
#bottomnav .ico { font-size: 21px; line-height: 1; filter: grayscale(.5); }
#bottomnav button.on { color: var(--gold); }
#bottomnav button.on .ico { filter: none; }
#bottomnav button.on::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }

/* ---------- لوحة المدينة/الدولة (من الأسفل) ---------- */
.sheet { position: fixed; z-index: 12; inset-inline: 0; bottom: calc(var(--nav-h) + var(--bottom)); max-height: 62%; overflow: auto; overscroll-behavior: contain;
  background: var(--panel-2); border: 1px solid var(--line); border-bottom: none; border-radius: 20px 20px 0 0; box-shadow: var(--shadow);
  padding: 6px max(16px, var(--right)) 16px max(16px, var(--left)); animation: sheetin .22s ease-out; }
@keyframes sheetin { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); margin: 2px auto 8px; }
.sheet > .close { position: absolute; top: 10px; left: max(12px, var(--left)); }
.sp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding-left: 44px; }
.flag { width: 36px; height: 27px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); object-fit: cover; flex: none; }
.flag.sm { width: 22px; height: 16px; vertical-align: middle; }
.sp-head h3 { margin: 0; font-size: 20px; }
.sp-head .sub { color: var(--muted); font-size: 12px; }
.sp-head .sub a { color: inherit; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tagchip { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); }
.tagchip.cap { border-color: var(--gold); color: var(--gold); }
.richbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.richbar div { text-align: center; background: rgba(0, 0, 0, .25); border-radius: 8px; padding: 5px 2px; font-size: 11px; }
.stars { color: var(--gold); letter-spacing: 1px; font-size: 10px; }
.citylist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cityrow { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); border: 1px solid transparent; cursor: pointer; }
.cityrow:active { border-color: var(--line); }
.cityrow .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cityrow .nm { flex: 1; font-weight: 600; min-width: 0; }

/* ---------- النوافذ الكاملة (من الأسفل على الجوال) ---------- */
.fullsheet { position: fixed; z-index: 30; inset-inline: 0; bottom: 0; top: calc(var(--top) + 40px); display: flex; flex-direction: column;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .6); animation: sheetin .22s ease-out; }
.fs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px max(16px, var(--right)) 10px max(16px, var(--left));
  border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(244, 197, 66, .12), transparent); border-radius: 20px 20px 0 0; }
.fs-head h2 { margin: 0; font-size: 19px; color: var(--gold); text-wrap: balance; }
.modal-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 14px max(16px, var(--right)) calc(var(--bottom) + 20px) max(16px, var(--left)); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.card { background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card h4 { margin: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; }
.card .lvl { color: var(--gold); font-size: 12px; white-space: nowrap; }
.card p { margin: 0; color: var(--muted); font-size: 12px; }
.cost { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; direction: ltr; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.cost span { display: inline-flex; align-items: center; gap: 3px; }
.cost span.lack { color: var(--red); }
.progress { height: 8px; background: rgba(255, 255, 255, .08); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-2), var(--gold)); transition: width 1s linear; }
.tblwrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl td .btn.sm { margin: 2px 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 10px; padding: 7px 14px; font-weight: 700; }
.tabs button.on { border-color: var(--gold); color: var(--gold); }
.unit-row { display: grid; grid-template-columns: 1fr 64px; grid-template-areas: "name have" "range num"; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.unit-row b { grid-area: name; } .unit-row .muted { grid-area: have; text-align: left; }
.unit-row input[type=range] { grid-area: range; width: 100%; accent-color: var(--gold); height: 28px; }
.unit-row input[type=number] { grid-area: num; }
.field.sm { padding: 6px 8px; font-size: 16px; width: 100%; }
.stat { display: inline-flex; gap: 4px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.report { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: rgba(255, 255, 255, .03); cursor: pointer; font-size: 13px; }
.report.win { border-inline-start: 4px solid var(--green); }
.report.loss { border-inline-start: 4px solid var(--red); }
.report.info { border-inline-start: 4px solid var(--blue); }
.report h4 { margin: 0 0 4px; font-size: 14px; }
.battle-bars { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.bb { display: grid; grid-template-columns: 56px 1fr 70px; gap: 8px; align-items: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.bb .track { height: 14px; background: rgba(255, 255, 255, .06); border-radius: 7px; overflow: hidden; }
.bb .track i { display: block; height: 100%; transition: width .6s ease; }
.bb.att i { background: linear-gradient(90deg, #ff7a3d, #ff3d3d); }
.bb.def i { background: linear-gradient(90deg, #3d9bff, #3dffd5); }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-grid button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px; border-radius: 14px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.menu-grid .ico { font-size: 26px; }
.menu-grid .badge { top: 6px; }

/* ---------- الدردشة ---------- */
#chat .fs-head { padding-block: 8px; }
.chat-tabs { display: flex; gap: 4px; flex: 1; }
.chat-tabs button { flex: 1; background: none; border: 1px solid transparent; border-radius: 10px; padding: 7px; font-weight: 700; color: var(--muted); }
.chat-tabs button.on { color: var(--gold); border-color: var(--gold); }
.chat-tabs button.new { color: var(--gold); }
.chat-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px max(14px, var(--right)) 8px max(14px, var(--left)); font-size: 14px; display: flex; flex-direction: column; gap: 5px; }
.msg { line-height: 1.6; overflow-wrap: anywhere; }
.msg .who { font-weight: 700; color: var(--blue); cursor: pointer; }
.msg .tg { color: var(--gold); font-weight: 700; }
.msg.sys { color: #ffe9a8; }
.msg.sys .who { color: var(--gold); }
.msg time { color: var(--muted); font-size: 10px; margin-inline-start: 4px; }
.chat-input { display: flex; gap: 6px; padding: 8px max(10px, var(--right)) calc(var(--bottom) + 8px) max(10px, var(--left)); border-top: 1px solid var(--line); }
.chat-input input { flex: 1; min-width: 0; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color: var(--text); }
#chat-to { flex: 0 0 90px; }

/* ---------- علامات المدن على الكرة ---------- */
.cm { position: relative; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; cursor: pointer; pointer-events: auto; user-select: none; padding: 4px; }
.cm svg { width: 22px; height: 22px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .8)); }
.cm .lbl { margin-top: -2px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; padding: 0 5px; border-radius: 4px; background: rgba(0, 0, 0, .55); text-shadow: 0 1px 2px #000; line-height: 16px; }
.cm.cap .lbl { color: var(--gold); }
.cm.mine .lbl { background: rgba(160, 110, 0, .9); color: #fff; }
.cm.hidden-lbl .lbl { display: none; }
.cm.far svg { width: 14px; height: 14px; }
.cm.picking .lbl { outline: 1px solid var(--green); }
.march-icon { transform: translate(-50%, -50%); font-size: 16px; filter: drop-shadow(0 0 4px #000); pointer-events: none; }
.boom { position: relative; transform: translate(-50%, -50%); pointer-events: none; width: 0; height: 0; }
.boom i { position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle, #fff7c2, #ff9a1f 40%, rgba(255, 60, 0, 0) 70%); animation: boom 1.4s ease-out forwards; }
.boom .smoke { background: radial-gradient(circle, rgba(80, 80, 80, .9), rgba(40, 40, 40, 0) 70%); animation-duration: 2.6s; }
@keyframes boom { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 1; } 100% { transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(var(--s)); opacity: 0; } }
.boom .flash { width: 130px; height: 130px; background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(255, 200, 80, 0) 65%); animation: flash .5s ease-out forwards; }
@keyframes flash { from { transform: translate(-50%, -50%) scale(.3); opacity: 1; } to { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } }
.globe-tip { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-family: var(--font); text-align: right; }
.globe-tip b { color: var(--gold); }

/* ---------- المدينة ثلاثية الأبعاد ---------- */
#cityview { position: fixed; inset: 0; z-index: 20; background: #9cc8ef; }
#city-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.cv-head { position: absolute; top: 0; inset-inline: 0; display: flex; align-items: center; gap: 10px;
  padding: calc(var(--top) + 8px) max(12px, var(--right)) 18px max(12px, var(--left)); background: linear-gradient(180deg, rgba(5, 12, 28, .9), transparent); }
.cv-title { flex: 1; min-width: 0; font-size: 19px; font-weight: 900; text-shadow: 0 2px 8px #000; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
.cv-sheet { position: absolute; inset-inline: 0; bottom: 0; height: 46%; display: flex; flex-direction: column; background: var(--panel-2); border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .5); transition: height .25s ease; }
.cv-sheet.tall { height: 82%; }
.cv-sheet.short { height: 120px; }
.cv-grip { width: 100%; height: 22px; background: none; border: none; flex: none; position: relative; }
.cv-grip::before { content: ""; position: absolute; top: 8px; left: 50%; width: 46px; height: 5px; margin-left: -23px; border-radius: 3px; background: rgba(255, 255, 255, .3); }
.cv-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 max(12px, var(--right)) 8px max(12px, var(--left)); flex: none; }
.cv-tabs button { background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 10px; padding: 7px; font-weight: 700; }
.cv-tabs button.on { border-color: var(--gold); color: var(--gold); }
.cv-panel { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 max(12px, var(--right)) calc(var(--bottom) + 14px) max(12px, var(--left)); display: flex; flex-direction: column; gap: 8px; }
.cv-panel .card.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.cv-label { position: absolute; transform: translate(-50%, -100%); pointer-events: none; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .6); padding: 1px 6px; border-radius: 5px; white-space: nowrap; z-index: 1; }
.cv-label.empty { color: #b9d2ff; background: rgba(20, 50, 100, .6); }
.cv-label.building { color: var(--gold); }

/* ---------- نافذة التأكيد ---------- */
#dialog { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .6); padding: 16px max(16px, var(--right)) 16px max(16px, var(--left)); }
.dialog-card { width: min(380px, 100%); background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.dialog-card p { margin: 0; font-size: 15px; line-height: 1.7; }
#dialog-extra:empty { display: none; }
#dialog-extra { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#dialog-extra label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }

/* ---------- تنبيهات ---------- */
#toasts { position: fixed; z-index: 70; top: calc(var(--top) + 60px); inset-inline: max(12px, var(--left)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { width: min(440px, 100%); background: var(--panel-2); border: 1px solid var(--line); border-inline-start: 4px solid var(--blue); border-radius: 10px; padding: 8px 12px; font-size: 13px; box-shadow: var(--shadow); animation: tin .25s ease-out; }
.toast.err { border-inline-start-color: var(--red); }
.toast.ok { border-inline-start-color: var(--green); }
.toast.warn { border-inline-start-color: var(--gold); }
@keyframes tin { from { transform: translateY(-14px); opacity: 0; } }

#loading { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); padding: 16px; text-align: center; }
.spinner { width: 46px; height: 46px; border: 4px solid rgba(244, 197, 66, .2); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- الشاشات الكبيرة: النوافذ في الوسط ---------- */
@media (min-width: 820px) {
  .fullsheet { top: auto; bottom: auto; left: 50%; right: auto; top: 50%; transform: translate(-50%, -50%); width: min(820px, 92vw); height: min(86vh, 900px); border-radius: 20px; border-bottom: 1px solid var(--line); animation: none; }
  .sheet { inset-inline: auto; left: max(16px, var(--left)); width: 400px; border-radius: 20px; bottom: calc(var(--nav-h) + var(--bottom) + 64px); border-bottom: 1px solid var(--line); max-height: 70%; }
  #chat-ticker { left: auto; width: 380px; }
  .cv-sheet { inset-inline: auto; right: 14px; top: 76px; bottom: 14px; height: auto; width: 400px; border-radius: 20px; border: 1px solid var(--line); }
  .cv-sheet.tall, .cv-sheet.short { height: auto; }
  .cv-grip { display: none; }
  .resources { grid-template-columns: repeat(4, minmax(0, 150px)); justify-content: center; }
  .res .ri { width: 26px; height: 26px; }
  .res b { font-size: 14px; } .res small { font-size: 11px; }
  .profile { max-width: 220px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* =====================================================================
   الإصدار الاستراتيجي: الخريطة المسطحة، شاشة المدينة، القصة والمستشار
   ===================================================================== */
#vignette { background: radial-gradient(ellipse at center, transparent 65%, rgba(0, 0, 0, 0.45) 100%); }
.art { width: 100%; height: auto; display: block; }
.gold { color: var(--gold); } .red { color: var(--red); }

/* شريط اللعبة: نقاط النصر، الوقت، اليوم، الدولة */
#gamebar { display: flex; gap: 6px; align-items: center; pointer-events: none; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
#gamebar > span { background: rgba(6, 14, 30, .86); border: 1px solid var(--line); border-radius: 7px; padding: 1px 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
#gamebar > span:empty { display: none; }
#gb-vp { color: var(--gold); }

/* أزرار جانب الخريطة */
#mapside { position: fixed; z-index: 9; top: calc(var(--top) + 96px); left: calc(var(--left) + 8px); display: flex; flex-direction: column; gap: 8px; }
#mapside button { position: relative; width: 58px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; font-size: 10px; font-weight: 700;
  background: linear-gradient(180deg, rgba(36, 92, 120, .95), rgba(16, 48, 72, .95)); border: 1px solid rgba(127, 211, 255, .45); border-radius: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
#mapside .ico { font-size: 20px; line-height: 1.1; }
#mapside .badge { top: -6px; left: auto; right: -6px; margin: 0; }
#mapctl { bottom: calc(var(--bottom) + var(--nav-h) + 62px); }
#mapctl button { width: 40px; height: 40px; font-size: 18px; }

/* لوحة مدينتي (من الأسفل) */
.city-strip { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px -16px 10px; padding: 10px 16px 10px 52px;
  background-color: #fff; background-position: right; background-size: cover; background-repeat: no-repeat; color: #14202e; }
.city-strip h3 { margin: 0; font-size: 19px; }
.city-strip small { color: #4b5a6b; font-weight: 600; }
.info-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: radial-gradient(circle, #3a9bd8, #1b5f8f); color: #fff; font-weight: 900; font-style: italic; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); flex: none; }
.city-work { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.cw-slot { display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-height: 58px; font-size: 11px; }
.cw-slot .art { width: 56px; flex: none; }
.cw-slot b { color: var(--gold); font-variant-numeric: tabular-nums; }
.city-stats { display: flex; justify-content: space-around; gap: 6px; background: rgba(0, 0, 0, .25); border-radius: 10px; padding: 7px; margin-bottom: 10px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* شاشة المدينة */
#cityscreen.city { z-index: 25; }
#cs-title { display: flex; align-items: center; gap: 8px; font-size: 18px; flex-wrap: wrap; }
#cs-title small { font-size: 12px; font-weight: 600; }
#cs-queue { padding: 8px max(12px, var(--right)) 4px max(12px, var(--left)); display: flex; flex-direction: column; gap: 6px; background: rgba(0, 0, 0, .2); }
.cq-row { display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, rgba(36, 92, 120, .35), rgba(16, 48, 72, .2)); border: 1px solid rgba(127, 211, 255, .3); border-radius: 10px; padding: 6px 8px; }
.cq-art { width: 64px; flex: none; }
.cq-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cq-info b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cq-info small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cq-speed { white-space: nowrap; }
.cq-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 8px; }
.cs-tabs { display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(6, 14, 30, .9); border-block: 1px solid var(--line); }
.cs-tabs button { background: none; border: none; padding: 7px 2px; font-size: 11px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.cs-tabs button span { font-size: 18px; filter: grayscale(.6); }
.cs-tabs button.on { color: #7fd3ff; background: linear-gradient(180deg, rgba(127, 211, 255, .18), transparent); box-shadow: inset 0 -3px 0 #7fd3ff; }
.cs-tabs button.on span { filter: none; }
.cs-subtabs { display: flex; gap: 0; background: rgba(16, 36, 60, .95); border-bottom: 1px solid var(--line); }
.cs-subtabs button { flex: 1; background: none; border: none; padding: 8px 4px; font-weight: 700; font-size: 13px; color: var(--muted); }
.cs-subtabs button.on { color: var(--text); background: linear-gradient(180deg, rgba(127, 211, 255, .22), rgba(127, 211, 255, .05)); box-shadow: inset 0 -2px 0 #7fd3ff; }
#cs-body { display: flex; flex-direction: column; gap: 10px; }
.item-card { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02)); border: 1px solid var(--line); }
.item-card::before, .item-card::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid rgba(127, 211, 255, .4); }
.item-card::before { top: 4px; right: 4px; border-left: none; border-bottom: none; }
.item-card::after { bottom: 4px; left: 4px; border-right: none; border-top: none; }
.ic-art { position: relative; }
.item-card.unit .ic-art { background: radial-gradient(ellipse at center, rgba(127, 211, 255, .12), transparent 70%); border-radius: 8px; }
.lvl-badge { position: absolute; bottom: -2px; left: -2px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; font-style: normal; font-weight: 900; font-size: 12px;
  display: grid; place-items: center; background: radial-gradient(circle, #4fd27b, #1f8a46); border: 2px solid #c9f5d8; color: #fff; }
.lvl-badge.have { background: radial-gradient(circle, #4aa3ff, #1b5f8f); border-color: #cfe8ff; }
.ic-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ic-main h4 { margin: 0; font-size: 15px; }
.ic-main p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.cost-grid { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; font-weight: 700; direction: ltr; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.cost-grid span { display: inline-flex; align-items: center; gap: 3px; }
.cost-grid span.lack { color: var(--red); }
.ic-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ic-act { display: flex; flex-direction: column; gap: 6px; align-items: stretch; width: 82px; }
.ic-act .field.sm { text-align: center; padding: 4px; }
.lock { font-size: 22px; text-align: center; opacity: .6; }
@media (max-width: 420px) {
  .item-card { grid-template-columns: 88px 1fr; }
  .ic-act { grid-column: 1 / -1; flex-direction: row; width: auto; justify-content: flex-end; }
  .ic-act .btn { flex: 0 0 auto; min-width: 96px; }
  .ic-act .field.sm { width: 80px; }
}

/* سجل المهام */
.quest-list { display: flex; flex-direction: column; gap: 8px; }
.quest { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.quest.ready { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(244, 197, 66, .4) inset; }
.quest.claimed { opacity: .5; }
.q-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.q-main h4 { margin: 0; font-size: 14px; } .q-main p { margin: 0; font-size: 12px; color: var(--muted); }
.q-main small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.q-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.q-reward { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 11px; direction: ltr; justify-content: flex-end; max-width: 130px; }
.q-reward span { display: inline-flex; align-items: center; gap: 2px; }
.q-done { color: var(--green); font-size: 12px; font-weight: 700; }

/* نشرة الأخبار الافتتاحية */
.intro { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; transition: opacity .4s; }
.intro.fade { opacity: 0; }
.intro-skip { position: absolute; top: calc(var(--top) + 12px); left: calc(var(--left) + 12px); background: rgba(0, 0, 0, .4); border: 1px solid rgba(255, 255, 255, .3); border-radius: 20px; padding: 6px 14px; font-weight: 700; z-index: 2; }
.news { background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .03) 0 2px, transparent 2px 4px), linear-gradient(180deg, #0c2440, #071628); padding-top: calc(var(--top) + 40px); }
.news-brand { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 0 max(18px, var(--right)); }
.news-logo { background: #c8102e; color: #fff; font-weight: 900; font-size: 30px; line-height: 1; padding: 10px 14px 6px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 6px 20px rgba(200, 16, 46, .4); }
.news-logo small { font-size: 13px; font-weight: 700; margin-top: 4px; }
.news-live { background: #555c62; color: #fff; font-weight: 900; letter-spacing: 3px; padding: 2px 16px; font-size: 13px; }
.news-wall { flex: 1; position: relative; margin: 18px 0; border-block: 3px solid #c8102e; background: linear-gradient(180deg, rgba(40, 120, 190, .25), rgba(20, 60, 110, .25)), repeating-linear-gradient(90deg, rgba(127, 211, 255, .07) 0 1px, transparent 1px 40px); overflow: hidden; }
.news-screen { position: absolute; background: rgba(8, 24, 44, .85); border: 1px solid rgba(127, 211, 255, .45); border-radius: 4px; padding: 6px; box-shadow: 0 0 18px rgba(80, 170, 255, .25); animation: drift 7s ease-in-out infinite alternate; }
.news-screen svg { width: 100%; height: 100%; }
.news-screen.s0 { top: 8%; right: 6%; width: 34%; height: 22%; } .news-screen.s1 { top: 6%; left: 8%; width: 30%; height: 26%; animation-delay: -2s; }
.news-screen.s2 { top: 36%; right: 18%; width: 64%; height: 30%; animation-delay: -4s; } .news-screen.s3 { bottom: 8%; right: 4%; width: 30%; height: 20%; animation-delay: -1s; }
.news-screen.s4 { bottom: 6%; left: 6%; width: 36%; height: 22%; animation-delay: -3s; } .news-screen.s5 { top: 40%; left: 2%; width: 14%; height: 18%; animation-delay: -5s; }
@keyframes drift { to { transform: translate(6px, -4px) scale(1.02); } }
.news-bar { margin: 0 0 calc(var(--bottom) + 40px); padding: 0 max(18px, var(--right)) 0 max(18px, var(--left)); }
.news-tag { display: inline-block; background: #c8102e; color: #fff; font-weight: 700; padding: 4px 16px; }
.news-headline { background: #fff; color: #10151c; font-weight: 900; font-size: 18px; padding: 16px 14px; min-height: 84px; border-inline-start: 5px solid #c8102e; line-height: 1.6; }
.wake { background: #000; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.wake p { font-size: 24px; font-weight: 900; opacity: 0; transition: opacity .9s; max-width: 22ch; line-height: 1.7; }
.wake p.show { opacity: 1; }

/* اختيار الدولة */
.cselect { position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; background: #24404f; }
.cs-head { padding: calc(var(--top) + 14px) 16px 16px; text-align: center; background: radial-gradient(circle at 20% 80%, rgba(127, 211, 255, .25), transparent 40%), radial-gradient(circle at 80% 60%, rgba(127, 211, 255, .2), transparent 40%), linear-gradient(180deg, #0d2233, #173a52); border-bottom: 2px solid rgba(127, 211, 255, .35); }
.cs-logo { display: inline-block; font-size: 22px; font-weight: 900; color: var(--gold); border: 2px solid var(--gold); padding: 2px 14px; border-radius: 6px; margin-bottom: 8px; }
.cs-head h2 { margin: 0; font-size: 20px; }
.cs-sub { background: #fff; color: #23313d; text-align: center; padding: 10px 16px; font-size: 13px; font-weight: 600; }
.cs-tools { padding: 8px max(12px, var(--right)) 6px max(12px, var(--left)); display: flex; flex-direction: column; gap: 6px; background: #1d3544; }
.cs-regions { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.cs-regions button { flex: none; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; font-size: 12px; font-weight: 700; }
.cs-regions button.on { border-color: #7fd3ff; color: #7fd3ff; }
.cs-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.cs-row { border-bottom: 1px solid rgba(255, 255, 255, .12); background: #2f4c5c; cursor: pointer; }
.cs-row:nth-child(even) { background: #2a4555; }
.cs-row.sel { background: linear-gradient(90deg, rgba(127, 211, 255, .35), rgba(127, 211, 255, .12)); box-shadow: inset -4px 0 0 #7fd3ff; }
.cs-row.taken { opacity: .55; }
.cs-main { display: flex; align-items: center; gap: 12px; padding: 14px max(16px, var(--right)) 14px max(16px, var(--left)); }
.cs-main b { font-size: 17px; flex: 1; }
.cs-main .flag { width: 38px; height: 28px; }
.cs-leader { font-size: 11px; color: #c8d6e0; }
.cs-meta { font-size: 11px; color: #a9c2d2; }
.cs-chev { color: #cfe; font-size: 16px; padding: 4px; }
.cs-detail { padding: 0 max(16px, var(--right)) 12px max(16px, var(--left)); display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.cs-res { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.cs-res span { background: rgba(0, 0, 0, .2); border-radius: 6px; padding: 4px; text-align: center; }
.cs-res i { display: block; color: var(--gold); font-style: normal; font-size: 10px; }
.cs-cities { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-cities span { background: rgba(255, 255, 255, .08); border-radius: 12px; padding: 2px 10px; }
.cs-foot { display: flex; gap: 10px; padding: 10px max(12px, var(--right)) calc(var(--bottom) + 12px) max(12px, var(--left)); background: #1d3544; border-top: 1px solid rgba(255, 255, 255, .15); }
.cs-foot #cs-random { flex: 3; background: linear-gradient(180deg, #2a8aa8, #175a72); border-color: #7fd3ff; box-shadow: 0 0 16px rgba(127, 211, 255, .45); }
.cs-foot #cs-ok { flex: 1; }

/* المستشار العسكري */
.advisor { position: fixed; z-index: 120; inset-inline: 0; bottom: 0; display: flex; align-items: flex-end; gap: 0; padding: 0 max(8px, var(--right)) calc(var(--bottom) + 8px) max(8px, var(--left));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .55) 40%); cursor: pointer; animation: sheetin .3s ease-out; }
.advisor.fade { opacity: 0; transition: opacity .25s; }
.adv-portrait { position: absolute; left: max(10px, var(--left)); bottom: calc(var(--bottom) + 96px); width: 132px; filter: drop-shadow(0 0 14px rgba(127, 211, 255, .55)); border-radius: 10px; overflow: hidden; border: 2px solid rgba(127, 211, 255, .7); }
.adv-box { width: 100%; margin-top: 140px; background: rgba(19, 41, 58, .97); border: 2px solid #7fd3ff; border-radius: 6px; padding: 12px 14px 8px; box-shadow: 0 0 22px rgba(127, 211, 255, .35); position: relative; }
.adv-box::before { content: ""; position: absolute; top: -10px; inset-inline: 10%; height: 4px; background: linear-gradient(90deg, transparent, #7fd3ff, transparent); }
.advisor.alert .adv-box { border-color: var(--red); box-shadow: 0 0 22px rgba(255, 90, 90, .45); }
.adv-name { color: #7fd3ff; font-weight: 900; font-size: 13px; }
.adv-text { margin: 4px 0; font-size: 15px; line-height: 1.8; min-height: 3.4em; }
.adv-hint { color: var(--muted); font-size: 11px; font-style: italic; }

/* نوافذ الأحداث */
.evpop { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .55); padding: 16px max(16px, var(--right)) 16px max(16px, var(--left)); animation: tin .2s ease-out; }
.evpop.fade { opacity: 0; transition: opacity .2s; }
.ev-card { width: min(400px, 100%); background: #13293a; border: 1px solid rgba(127, 211, 255, .45); box-shadow: 0 0 30px rgba(127, 211, 255, .25), var(--shadow); }
.ev-head { display: flex; align-items: center; justify-content: space-between; background: #fff; color: #14202e; padding: 10px 14px; }
.ev-head h3 { margin: 0; font-size: 20px; font-weight: 900; }
.ev-x { width: 34px; height: 34px; border: none; border-radius: 4px; background: linear-gradient(180deg, #e04848, #8f1d1d); color: #fff; font-weight: 900; }
.scene { position: relative; }
.scene > svg { width: 100%; height: auto; display: block; }
.scene-subject { position: absolute; inset: 10% 18% 6%; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .55)); }
.scene-subject .art { max-height: 100%; width: auto; max-width: 100%; }
.ev-text { margin: 0; padding: 10px 14px 0; text-align: center; font-weight: 700; }
.ev-reward { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 14px; padding: 8px 14px 0; color: var(--gold); font-weight: 900; font-size: 15px; }
.ev-go { display: block; width: calc(100% - 28px); margin: 12px 14px 14px; background: linear-gradient(180deg, #2a8aa8, #175a72); border-color: #7fd3ff; box-shadow: 0 0 14px rgba(127, 211, 255, .4); font-size: 16px; padding: 12px; }
body.sheet-open #chat-ticker, body.sheet-open #mapctl { display: none; }
.intro-skip { left: auto; right: calc(var(--right) + 12px); }
/* النوافذ تبدأ أسفل شريط الموارد ليبقى ظاهراً كما في ألعاب الاستراتيجية */
@media (max-width: 819px) { .fullsheet { top: calc(var(--top) + 60px); } #cityscreen.city { top: calc(var(--top) + 60px); border-radius: 0; } }
.sheet > .close { z-index: 3; background: rgba(10, 21, 42, .85); }

/* ===================== الصور الحقيقية ===================== */
.art.photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #0b1a2c; box-shadow: 0 2px 8px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .08); }
.item-card { grid-template-columns: 132px 1fr auto; }
.item-card .ic-art .art.photo { border: 1px solid rgba(127, 211, 255, .35); }
.item-card.unit .ic-art { background: none; }
.cq-art .art.photo, .cw-slot .art.photo { aspect-ratio: 4 / 3; border-radius: 6px; }
.cw-slot .art { width: 64px; }
.scene-photo { position: relative; aspect-ratio: 320 / 170; overflow: hidden; background: #0b1a2c; }
.scene-photo .art.photo { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none;
  filter: saturate(.7) contrast(1.12) brightness(.92); }
.scene-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(22, 50, 74, .15), rgba(11, 26, 44, .55)), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55)); }
.scene-scan { position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(0deg, rgba(127, 211, 255, .07) 0 1px, transparent 1px 3px); pointer-events: none; }
.scene-frame { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }
@media (max-width: 420px) { .item-card { grid-template-columns: 128px 1fr; } }
.item-card.locked .ic-art .art.photo { filter: grayscale(.85) brightness(.55); }

/* ===================== الإعدادات ===================== */
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 6px 0; cursor: pointer; }
.toggle input { width: 22px; height: 22px; accent-color: var(--gold); }
.card .field { width: 100%; margin-bottom: 6px; }

/* ===================== مشهد المعركة ===================== */
.bscene { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: -4px 0 12px; padding: 10px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(255, 120, 40, .25), transparent 60%), linear-gradient(180deg, #1b2a3c, #0b1622); border: 1px solid rgba(255, 140, 60, .35); }
.bs-side { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; font-size: 12px; text-align: center; min-width: 0; }
.bs-side .art { width: 100%; max-width: 150px; }
.bs-side.att .art.photo { border: 2px solid #ff7a3d; animation: bs-push-a 1.2s ease-in-out infinite alternate; }
.bs-side.def .art.photo { border: 2px solid #3d9bff; animation: bs-push-d 1.2s ease-in-out infinite alternate; }
.bs-side.att span { color: #ff9a6a; } .bs-side.def span { color: #7fc0ff; }
.bs-vs { font-weight: 900; font-size: 22px; color: var(--gold); text-shadow: 0 0 12px rgba(244, 197, 66, .7); }
@keyframes bs-push-a { to { transform: translateX(-6px) scale(1.03); } }
@keyframes bs-push-d { to { transform: translateX(6px) scale(1.03); } }
.bs-boom { position: absolute; width: 60px; height: 60px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255, 245, 200, .95), rgba(255, 140, 30, .7) 40%, transparent 70%); opacity: 0; animation: bs-boom 1.8s ease-out infinite; }
.bs-boom.b1 { top: 20%; left: 45%; } .bs-boom.b2 { top: 55%; left: 30%; animation-delay: .6s; } .bs-boom.b3 { top: 35%; left: 60%; animation-delay: 1.2s; }
@keyframes bs-boom { 0% { transform: scale(.2); opacity: 1; } 60% { opacity: .8; } 100% { transform: scale(1.8); opacity: 0; } }
