/* ===== خط وزیرمتن — مستضاف ذاتياً، يعمل بلا إنترنت وداخل الـAPK ===== */
@font-face {
  font-family:'Vazirmatn';
  src:local('Vazirmatn'), url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight:400; font-style:normal; font-display:swap;
}
@font-face {
  font-family:'Vazirmatn';
  src:local('Vazirmatn Bold'), url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight:700; font-style:normal; font-display:swap;
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; user-select:none; }
html,body { width:100%; height:100%; overflow:hidden; background:#0d2318;
  font-family:'Vazirmatn','Segoe UI',Tahoma,sans-serif; color:#f5e9d0; }

.screen { position:absolute; inset:0; display:none; flex-direction:column; }
.screen.active { display:flex; }

/* ===== buttons ===== */
.btn { border:none; border-radius:14px; padding:12px 26px; margin:6px auto; font-size:18px; font-weight:bold;
  background:#2e7d4f; color:#fff; cursor:pointer; box-shadow:0 4px 0 #1a4c2e; display:block; font-family:inherit; }
.btn:active { transform:translateY(3px); box-shadow:0 1px 0 #1a4c2e; }
.btn.gold { background:linear-gradient(#e8b93b,#c98f1c); color:#3a2503; box-shadow:0 4px 0 #8a5f0e; }
.btn.big { font-size:24px; padding:16px 46px; }
.btn.small { font-size:14px; padding:8px 18px; }
.btn.icon { width:46px; height:46px; padding:0; font-size:22px; margin:0; border-radius:12px; }

/* ===== menu ===== */
#scr-menu { align-items:center; justify-content:center; }
.menu-bg { position:absolute; inset:0; background:linear-gradient(#173a2a 0%, #1a5c3a 55%, #c98f1c 100%); z-index:-1; }
.menu-inner { text-align:center; padding:20px; position:relative; }
.logo-dome { font-size:72px; filter:drop-shadow(0 6px 12px rgba(0,0,0,.5)); }
h1 { font-size:34px; text-shadow:0 3px 6px rgba(0,0,0,.6); margin:8px 0 2px; }
.menu-sub { color:#ffd97a; margin-bottom:26px; font-size:18px; }

.wallet { display:flex; gap:12px; justify-content:center; margin-top:18px; font-size:17px; font-weight:bold; }
.wallet span { background:rgba(0,0,0,.35); border-radius:20px; padding:5px 14px; }

/* ===== topbar ===== */
.topbar { display:flex; align-items:center; justify-content:space-between; padding:10px 12px; gap:8px; z-index:5; flex-wrap:wrap; }
.goal-chip { background:rgba(0,0,0,.4); border-radius:20px; padding:7px 16px; font-size:16px; font-weight:bold; }
/* شمارنده‌ی حرکت وقتی کم می‌شود — هشدارِ دیدنیِ شرطِ باخت (§۸.۹.الف) */
.goal-chip.low { background:rgba(176,48,48,.75); color:#fff; animation:chipPulse .9s infinite; }
@keyframes chipPulse { 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.09); } }

/* ===== map ===== */
#scr-map { background:linear-gradient(#173a2a, #0d2318); overflow:hidden; }
.map-title { text-align:center; font-size:22px; color:#ffd97a; margin:4px 0 10px; }
.map-path { flex:1; overflow-y:auto; padding:10px 0 40px; display:flex; flex-direction:column; align-items:center; gap:14px; }
.map-node { width:76px; height:76px; border-radius:50%; display:flex; flex-direction:column; align-items:center; justify-content:center;
  font-size:30px; background:#2e7d4f; box-shadow:0 5px 0 #1a4c2e; cursor:pointer; position:relative; }
.map-node .lvl-num { font-size:13px; font-weight:bold; color:#ffd97a; }
.map-node.locked { background:#3a4a41; filter:grayscale(.8); box-shadow:0 5px 0 #222; }
.map-node.done { background:linear-gradient(#e8b93b,#c98f1c); box-shadow:0 5px 0 #8a5f0e; }
.map-node.done .lvl-num { color:#3a2503; }
.map-node .stars { font-size:12px; letter-spacing:-2px; }
/* رنگِ تأکیدِ فصل روی حلقه‌ی هر گره (§۸.۹.ه) */
.map-node:not(.locked) { border:2px solid var(--acc, #e8b93b); }
/* مرحله‌ی ردشده رنگش فرق دارد و ستاره ندارد (§۹.۶) */
.map-node.skipped { background:linear-gradient(#6b6152,#4a4238); box-shadow:0 5px 0 #2c2721; }
.map-node.skipped .lvl-num { color:#d8cdb6; }
.map-node:nth-child(odd) { transform:translateX(-60px); }
.map-node:nth-child(even) { transform:translateX(60px); }

/* ===== game canvases ===== */
.game-screen { background:#173a2a; }
canvas { display:block; margin:0 auto; touch-action:none; border-radius:10px; }

/* ===== battle unit bar ===== */
.unit-bar { display:flex; justify-content:center; gap:10px; padding:10px; }
.unit-btn { width:74px; height:74px; border-radius:16px; border:none; font-size:26px; background:#2e7d4f;
  box-shadow:0 4px 0 #1a4c2e; color:#fff; cursor:pointer; display:flex; flex-direction:column; align-items:center; justify-content:center; font-family:inherit; }
.unit-btn small { font-size:12px; font-weight:bold; color:#ffd97a; }
.unit-btn:disabled { filter:grayscale(.7); opacity:.6; }
.unit-btn:active { transform:translateY(3px); }

/* ===== care ===== */
#scr-care { background:linear-gradient(#2a4a6a 0%, #173a2a 60%, #6b4a1c 100%); }
.care-stage { flex:1; position:relative; display:flex; align-items:flex-end; justify-content:center; }
.care-house { font-size:110px; line-height:1; margin-bottom:0; filter:drop-shadow(0 8px 10px rgba(0,0,0,.5)); }
.care-char { position:absolute; bottom:8px; inset-inline-start:18%; font-size:64px; transition:transform .3s; }
.care-char.shiver { animation:shiver .15s infinite; }
.care-char.happy { animation:hop .5s 3; }
@keyframes shiver { 0%{transform:translateX(-2px)} 50%{transform:translateX(2px)} 100%{transform:translateX(-2px)} }
@keyframes hop { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-24px)} }
.care-bubble { position:absolute; top:12%; inset-inline-start:12%; background:#fff; color:#333; border-radius:16px;
  padding:10px 16px; font-size:17px; font-weight:bold; max-width:70%; box-shadow:0 4px 10px rgba(0,0,0,.4); }
.care-bubble:empty { display:none; }
.care-question { text-align:center; font-size:19px; font-weight:bold; color:#ffd97a; padding:8px 16px; }
.care-options { display:flex; justify-content:center; gap:12px; padding:0 12px 22px; }
.care-opt { flex:1; max-width:130px; background:#f5e9d0; color:#3a2503; border:none; border-radius:16px; padding:12px 6px;
  font-size:15px; font-weight:bold; cursor:pointer; box-shadow:0 5px 0 #b09a70; font-family:inherit; }
.care-opt .em { font-size:36px; display:block; }
.care-opt .price { display:block; color:#8a5f0e; margin-top:4px; }
.care-opt:active { transform:translateY(3px); }
.care-opt.wrong { animation:shiver .12s 4; background:#e88; }

/* ===== shop ===== */
.shop-items { flex:1; overflow-y:auto; padding:10px 18px 30px; display:flex; flex-direction:column; gap:12px; }
.shop-card { background:rgba(255,255,255,.08); border-radius:16px; padding:14px 18px; display:flex; align-items:center; gap:14px; }
.shop-card .em { font-size:38px; }
.shop-card .info { flex:1; }
.shop-card .info b { font-size:18px; }
.shop-card .info small { display:block; color:#cbbfa4; }

/* ===== overlays ===== */
.overlay { position:absolute; inset:0; background:rgba(0,0,0,.65); display:flex; align-items:center; justify-content:center; z-index:50; }
.overlay.hidden { display:none; }
.overlay-card, .story-card { background:linear-gradient(#20503a,#173a2a); border:2px solid #c98f1c; border-radius:22px;
  padding:26px 30px; text-align:center; max-width:88%; width:360px; box-shadow:0 12px 40px rgba(0,0,0,.6);
  position:relative; }

/* ===== راهِ برگشت §۵.۷ — ضربدرِ گوشه‌ی هر اورلی، لمس‌پذیر ۴۴px ===== */
.ov-close { position:absolute; top:6px; inset-inline-end:6px; width:44px; height:44px; padding:0;
  border:none; border-radius:12px; background:rgba(0,0,0,.35); color:#f5e9d0; font-size:20px;
  cursor:pointer; display:flex; align-items:center; justify-content:center; z-index:2; }
.ov-close:active { transform:scale(.92); }
.ov-close .ic { width:20px; height:20px; }
.ov-emoji { font-size:58px; }
.overlay-card h2 { color:#ffd97a; margin:6px 0; }
.overlay-card p, .story-card p { font-size:17px; line-height:1.7; margin:8px 0 14px; }
.ov-reward { font-size:20px; font-weight:bold; margin-bottom:12px; }
.ov-reward:empty { display:none; }
#ov-btn2:empty { display:none; }

/* ======================================================================
   إضافات النسخة الكاملة: القلوب، العرض الخاص، السجل، العجلة، الدخول اليومي،
   المعزّزات، تابع اللعب، الإعلان — حسب _kit/GAME-ANATOMY.md
   ====================================================================== */

.btn.tiny { font-size:12px; padding:4px 12px; margin:4px 0 0; }
.btn.ghost { background:rgba(255,255,255,.12); box-shadow:0 4px 0 rgba(0,0,0,.3); }
.btn:disabled { filter:grayscale(.6); opacity:.7; }
.btn.pulse { animation:pulse 1.1s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.06)} }

/* ===== القائمة: صف الأزرار + شارة العرض + القلوب ===== */
.menu-row { display:flex; gap:8px; justify-content:center; }
.menu-row .btn { margin:5px 0; flex:1; }
.offer-badge { position:absolute; top:-10px; inset-inline-end:-4px; font-size:30px;
  background:linear-gradient(#e8b93b,#c98f1c); border:none; border-radius:50%; width:58px; height:58px;
  cursor:pointer; box-shadow:0 4px 12px rgba(0,0,0,.5); animation:pulse 1.1s infinite; display:none; }
.lives-chip { background:rgba(0,0,0,.35); border-radius:20px; padding:5px 14px; font-size:16px;
  font-weight:bold; display:inline-block; margin-top:10px; }
.lives-chip small { color:#ffd97a; font-size:12px; }
.topbar .lives-chip, .topbar .wallet { margin-top:0; }

/* ===== عنوان الفصل على الخريطة ===== */
.chapter-label { background:rgba(232,185,59,.15); border:1px solid #c98f1c; color:#ffd97a;
  border-radius:20px; padding:5px 20px; font-size:15px; font-weight:bold; margin-top:6px; }
.chapter-label:nth-child(odd), .chapter-label:nth-child(even) { transform:none; }

/* ===== بطاقات المتجر الخاصة ===== */
.shop-card.starter { border:2px solid #e8b93b; background:rgba(232,185,59,.14); animation:glow 1.4s infinite; }
.shop-card.piggy { border:1px solid #2e7d4f; background:rgba(46,125,79,.22); }
.shop-card .timer { color:#ffd97a; font-weight:bold; }
@keyframes glow { 0%,100%{box-shadow:0 0 4px rgba(232,185,59,.4)} 50%{box-shadow:0 0 18px rgba(232,185,59,.8)} }

/* ===== سجل الفارس ===== */
.pass-progress { text-align:center; font-size:17px; font-weight:bold; color:#ffd97a; margin:2px 0 6px; }
#pass-gold-btn { margin:0 auto 8px; }
.pass-items { flex:1; overflow-y:auto; padding:4px 14px 30px; display:flex; flex-direction:column; gap:8px; }
.pass-row { display:flex; gap:8px; align-items:stretch; }
.pass-row.locked { opacity:.45; }
.pass-tier { width:64px; background:rgba(255,255,255,.1); border-radius:12px; display:flex;
  flex-direction:column; align-items:center; justify-content:center; font-size:18px; }
.pass-tier small { font-size:10px; color:#cbbfa4; }
.pass-cell { flex:1; border-radius:12px; padding:8px; text-align:center; font-size:15px; font-weight:bold;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.pass-cell.free { background:rgba(46,125,79,.35); }
.pass-cell.gold { background:rgba(232,185,59,.2); border:1px solid #c98f1c; }
.pass-cell.claimed { opacity:.55; }
.pass-cell b { color:#7fe8a0; }

/* ===== عجلة الحظ ===== */
#scr-wheel { align-items:center; }
.wheel-bird { font-size:52px; margin-top:6px; filter:drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
.wheel-grid { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:10px; margin:14px auto; width:100%; max-width:350px; }
.wheel-cell { width:100%; aspect-ratio:1; min-width:0; background:rgba(255,255,255,.08); border-radius:16px; display:flex;
  flex-direction:column; align-items:center; justify-content:center; font-weight:bold; border:2px solid transparent; }
.wheel-cell .em { font-size:28px; }
.wheel-cell small { color:#ffd97a; }
.wheel-cell.hot { border-color:#ffd97a; background:rgba(232,185,59,.3); transform:scale(1.08); }

/* ===== الدخول اليومي ===== */
.login-days { display:grid; grid-template-columns:repeat(4, 1fr); gap:8px; margin:10px 0 14px; }
.login-day { background:rgba(255,255,255,.08); border-radius:12px; padding:8px 4px; text-align:center;
  font-size:14px; font-weight:bold; border:2px solid transparent; }
.login-day small { display:block; color:#cbbfa4; font-size:11px; }
.login-day.today { border-color:#ffd97a; background:rgba(232,185,59,.25); animation:pulse 1.1s infinite; }
.login-day.past { opacity:.4; }

/* ===== المعزّزات ===== */
.prep-list { display:flex; flex-direction:column; gap:8px; margin:10px 0 14px; }
.boost-card { display:flex; align-items:center; gap:10px; background:rgba(255,255,255,.08);
  border:2px solid transparent; border-radius:14px; padding:10px 14px; color:#f5e9d0;
  font-family:inherit; font-size:15px; font-weight:bold; cursor:pointer; }
.boost-card .em { font-size:26px; }
.boost-card .bn { flex:1; text-align:start; }
.boost-card .price { color:#ffd97a; }
.boost-card.sel { border-color:#ffd97a; background:rgba(232,185,59,.22); }

/* ===== طبقات خاصة ===== */
.cont-card { border-color:#e85a3a; }
.ad-card { border-color:#7a5cc9; }
.overlay-card h2:empty, .overlay-card p:empty { display:none; }

/* ===== حاشیه‌ی امنِ دستگاه (ناچ بالا / نوار خانه‌ی پایین) — موبایل‌فرست ===== */
.topbar       { padding-top:    calc(10px + env(safe-area-inset-top, 0px)); }
.menu-inner   { padding-top:    calc(20px + env(safe-area-inset-top, 0px));
                padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.map-path     { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
.shop-items,
.pass-items   { padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
.care-options { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
.unit-bar     { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.sj-tools     { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }

/* ===== راهنمای گام‌به‌گام (فلش‌دار) — از _kit/tutor.css ===== */
/* توجه: همه‌ی انیمیشن‌ها CSS خالصه (نه RAF) — تو پنل مخفی هم کار می‌کنه. GAME-DESIGN §۷ */
.tut { position:fixed; inset:0; z-index:80; display:none; pointer-events:none; }
.tut.on { display:block; }
.tut-mask  { position:fixed; background:rgba(0,0,0,.72); pointer-events:auto; }
.tut-ring  { position:fixed; border:3px solid #ffd97a; border-radius:16px; pointer-events:none;
             box-shadow:0 0 18px rgba(255,217,122,.9); animation:tutPulse 1.1s infinite; }
.tut-ring.dim { border-color:rgba(255,217,122,.55); box-shadow:none; animation:none; }
@keyframes tutPulse { 0%,100%{transform:scale(1); opacity:1} 50%{transform:scale(1.06); opacity:.75} }
.tut-arrow { position:fixed; width:28px; height:28px; pointer-events:none; color:#ffd97a;
             font-size:28px; line-height:28px; text-align:center; animation:tutBob .9s infinite; }
.tut-arrow::before { content:'▼'; }
@keyframes tutBob { 0%,100%{ margin-top:0 } 50%{ margin-top:8px } }
.tut-hand { position:fixed; font-size:34px; pointer-events:none;
            filter:drop-shadow(0 3px 5px rgba(0,0,0,.6)); }
.tut-hand.tap  { animation:tutTap 1.2s infinite; }
.tut-hand.drag { animation:tutDrag 1.8s infinite; }
@keyframes tutTap  { 0%,100%{ transform:scale(1) } 45%{ transform:scale(.78) } }
@keyframes tutDrag { 0%{ transform:translate(0,0) scale(1) }
                     15%{ transform:translate(0,0) scale(.8) }
                     70%{ transform:translate(var(--dx),var(--dy)) scale(.8) }
                     85%,100%{ transform:translate(var(--dx),var(--dy)) scale(1); opacity:0 } }
.tut-bubble { position:fixed; width:240px; background:#fff; color:#222; border-radius:14px;
              padding:10px 14px; font-size:16px; font-weight:bold; text-align:center;
              pointer-events:none; box-shadow:0 6px 18px rgba(0,0,0,.5); }
.tut-skip { position:fixed; bottom:14px; inset-inline-end:14px; background:rgba(255,255,255,.16);
            color:#fff; border:none; border-radius:12px; padding:7px 14px; font-size:13px;
            font-family:inherit; cursor:pointer; pointer-events:auto; }

/* ===== جای بنر تبلیغ (ads.js — با provider واقعی نشون داده می‌شه) ===== */
#ad-banner { position:fixed; left:0; right:0; bottom:0; height:50px;
             background:rgba(0,0,0,.85); z-index:45; }
#ad-banner[hidden] { display:none; }

/* ═════ هنرِ کارفرما — پس‌زمینه‌ی صحنه‌ها (ALL-GAMES §۱۷.۲) — ساختِ _kit/art-all.py ═════
   متغیرِ --art-bg را js/art.js فقط وقتی ست می‌کند که فایل واقعاً لود شده باشد.
   نبودِ فایل ⇒ متغیر خالی ⇒ همان پس‌زمینه‌ی قبلی (بازی نمی‌شکند). */
.screen::before, [id^="scr-"]::before {
  content:''; position:absolute; inset:0; z-index:0; pointer-events:none;
  background-image:var(--art-bg, none); background-size:cover; background-position:center;
  opacity:.38;
}
.screen > *, [id^="scr-"] > * { position:relative; z-index:1; }
