* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body { width:100%; height:100%; overflow:hidden; background:#93c13d; font-family:Tahoma, Arial, sans-serif; direction:rtl; }
#game { position:fixed; inset:0; touch-action:none; display:block; }
.hidden { display:none !important; }

/* Player card top-left */
#playerCard { position:fixed; top:8px; left:8px; z-index:20; display:flex; align-items:center; gap:6px;
  background:linear-gradient(#ffe9a8,#f5c94c); border:2px solid #a67c1a; border-radius:10px; padding:4px 8px 4px 10px;
  box-shadow:0 2px 6px rgba(0,0,0,.4); direction:ltr; }
#avatar { width:40px; height:40px; border-radius:8px; background:#3b5bdb; display:flex; align-items:center; justify-content:center; font-size:22px; border:2px solid #243b8f; }
#playerName { font-weight:bold; font-size:13px; color:#5b3a00; }
#playerPoints { font-size:12px; color:#7a4c00; }

/* Resource bar */
#topbar { position:fixed; top:8px; left:50%; transform:translateX(-50%); z-index:20; display:flex; gap:4px; direction:ltr; }
.resChip { display:flex; align-items:center; gap:3px; background:linear-gradient(#ffe9a8,#f5c94c);
  border:2px solid #a67c1a; border-radius:8px; padding:2px 7px; font-size:12px; font-weight:bold; color:#5b3a00;
  box-shadow:0 2px 4px rgba(0,0,0,.35); min-width:64px; justify-content:center; }
.resIcon { font-size:14px; }

/* Top right buttons */
#topBtns { position:fixed; top:8px; right:8px; z-index:20; display:flex; gap:6px; }
.roundBtn { width:42px; height:42px; border-radius:10px; border:2px solid #a67c1a; background:linear-gradient(#ffe9a8,#f5c94c);
  font-size:20px; cursor:pointer; box-shadow:0 2px 4px rgba(0,0,0,.35); position:relative; }
.badge { position:absolute; top:-6px; left:-6px; background:#e03131; color:#fff; border-radius:50%; width:18px; height:18px;
  font-size:12px; display:flex; align-items:center; justify-content:center; border:2px solid #fff; }

/* Bottom bar */
#bottombar { position:fixed; bottom:10px; left:0; right:0; z-index:20; display:flex; justify-content:center; align-items:flex-end; gap:26px; pointer-events:none; }
#bottombar > * { pointer-events:auto; }
.sideBtn { width:64px; height:56px; border-radius:14px; border:2px solid #a67c1a; background:linear-gradient(#ffe9a8,#f5c94c);
  font-size:20px; cursor:pointer; box-shadow:0 3px 6px rgba(0,0,0,.4); display:flex; flex-direction:column; align-items:center; justify-content:center; color:#5b3a00; }
.sideBtn span { font-size:11px; font-weight:bold; }
#warBtn { width:92px; height:92px; border-radius:50%; border:4px solid #ffd43b; cursor:pointer;
  background:radial-gradient(circle at 35% 30%, #ff6b6b, #c92a2a 70%); box-shadow:0 4px 12px rgba(0,0,0,.5), inset 0 2px 6px rgba(255,255,255,.4);
  display:flex; flex-direction:column; align-items:center; justify-content:center; color:#fff; }
#warBtn .swords { font-size:30px; }
#warBtn .warTxt { font-size:15px; font-weight:bold; text-shadow:0 1px 2px #000; }
#warBtn:active { transform:scale(.95); }

/* Raid bar */
#raidbar { position:fixed; bottom:10px; left:0; right:0; z-index:20; display:flex; align-items:center; justify-content:center; gap:8px; }
#raidUnits { display:flex; gap:6px; overflow-x:auto; max-width:52vw; padding:2px; }
.unitCard { width:58px; height:64px; border-radius:10px; border:2px solid #a67c1a; background:linear-gradient(#ffe9a8,#f5c94c);
  display:flex; flex-direction:column; align-items:center; justify-content:center; cursor:pointer; position:relative; font-size:22px; }
.unitCard .cnt { position:absolute; bottom:2px; left:4px; font-size:12px; font-weight:bold; color:#5b3a00; }
.unitCard.sel { border-color:#e03131; box-shadow:0 0 0 3px #e0313155; }
.unitCard.zero { opacity:.4; }
#endWarBtn { background:linear-gradient(#ff8787,#e03131); color:#fff; border:2px solid #8f1d1d; border-radius:12px;
  padding:12px 14px; font-size:14px; font-weight:bold; cursor:pointer; box-shadow:0 3px 6px rgba(0,0,0,.4); white-space:nowrap; }
#raidTimer { background:#000000aa; color:#ffd43b; border-radius:10px; padding:8px 10px; font-size:16px; font-weight:bold; direction:ltr; }

/* Placement bar */
#placeBar { position:fixed; top:60px; left:50%; transform:translateX(-50%); z-index:25; background:#000000bb; color:#fff;
  border-radius:12px; padding:8px 14px; display:flex; gap:10px; align-items:center; font-size:14px; }
#placeBar button { background:#e03131; color:#fff; border:none; border-radius:8px; padding:6px 12px; font-weight:bold; cursor:pointer; }

/* Sheets & modals */
.sheet { position:fixed; bottom:0; left:0; right:0; z-index:30; background:linear-gradient(#fff3d6,#ffe3a1);
  border-top:3px solid #a67c1a; border-radius:18px 18px 0 0; max-height:55%; display:flex; flex-direction:column; box-shadow:0 -4px 16px rgba(0,0,0,.5); }
.sheetHead { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; font-size:17px; font-weight:bold; color:#5b3a00; }
.warHead { background:linear-gradient(#e8590c,#c92a2a); color:#fff; border-radius:12px 12px 0 0; }
.closeX { background:none; border:none; font-size:18px; cursor:pointer; color:inherit; }
.tabs { display:flex; gap:6px; padding:0 14px 8px; }
.tab { flex:1; padding:8px; border-radius:10px; border:2px solid #a67c1a; background:#fff8e1; font-weight:bold; color:#7a4c00; cursor:pointer; font-size:14px; }
.tab.active { background:#f5c94c; color:#3d2800; }
.cards { display:flex; gap:8px; overflow-x:auto; padding:6px 14px 16px; }
.bCard { min-width:96px; border:2px solid #a67c1a; border-radius:12px; background:#fffbe8; padding:8px 6px; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; gap:3px; text-align:center; }
.bCard .ic { font-size:28px; }
.bCard .nm { font-size:12px; font-weight:bold; color:#5b3a00; }
.bCard .cs { font-size:10px; color:#8a6d2f; line-height:1.5; }
.bCard.cant { opacity:.5; }

.modal { position:fixed; inset:0; z-index:35; background:rgba(0,0,0,.55); display:flex; align-items:center; justify-content:center; padding:14px; }
.modalBox { background:linear-gradient(#fff3d6,#ffe3a1); border:3px solid #a67c1a; border-radius:16px; width:100%; max-width:420px;
  max-height:80%; overflow-y:auto; box-shadow:0 6px 20px rgba(0,0,0,.6); }
.warBox { max-width:480px; border-color:#c92a2a; }
#bInfoBody, #armyBody, #questsBody, #resultBody { padding:6px 16px 16px; font-size:14px; color:#5b3a00; line-height:1.9; }
.bigBtn { display:block; margin:0 auto 16px; background:linear-gradient(#69db7c,#2f9e44); color:#fff; border:2px solid #1e7a30;
  border-radius:12px; padding:10px 34px; font-size:16px; font-weight:bold; cursor:pointer; }
.upBtn { background:linear-gradient(#74c0fc,#1971c2); color:#fff; border:2px solid #155a9e; border-radius:10px;
  padding:8px 18px; font-size:14px; font-weight:bold; cursor:pointer; margin-top:6px; }
.upBtn:disabled { background:#adb5bd; border-color:#868e96; cursor:default; }

/* War list rows */
.warRow { display:flex; align-items:center; gap:8px; background:#fff8e1; border:2px solid #d0a53c; border-radius:12px;
  padding:8px 10px; margin:0 12px 8px; }
.warRow.done { opacity:.55; }
.warRow .flag { font-size:26px; }
.warRow .info { flex:1; font-size:13px; color:#5b3a00; }
.warRow .info b { font-size:14px; }
.warRow .loot { font-size:11px; color:#8a6d2f; }
.enterBtn { background:linear-gradient(#ff8787,#e03131); color:#fff; border:2px solid #8f1d1d; border-radius:10px;
  padding:8px 16px; font-weight:bold; cursor:pointer; font-size:14px; }
.enterBtn:disabled { background:#adb5bd; border-color:#868e96; }
#refreshNpcs { display:block; margin:4px auto 14px; }

/* World map */
#worldMap { position:relative; height:340px; margin:0 12px 14px; border-radius:12px; overflow:hidden;
  background:
    radial-gradient(ellipse 90px 50px at 18% 22%, rgba(120,95,60,0.55), transparent 70%),
    radial-gradient(ellipse 120px 60px at 72% 30%, rgba(110,88,55,0.5), transparent 70%),
    radial-gradient(ellipse 100px 55px at 40% 68%, rgba(120,95,60,0.5), transparent 70%),
    radial-gradient(ellipse 130px 70px at 82% 78%, rgba(105,82,50,0.55), transparent 70%),
    radial-gradient(ellipse 80px 45px at 55% 45%, rgba(130,105,68,0.4), transparent 70%),
    linear-gradient(#c9b183, #b89f72); }
.signpost { position:absolute; display:flex; flex-direction:column; align-items:center; cursor:pointer; transform:translate(-50%,-100%); }
.signpost .board { background:linear-gradient(#fdf3d8,#eed9a4); border:2px solid #8a6d2f; border-radius:6px; padding:4px 8px;
  font-size:11px; font-weight:bold; color:#5b3a00; text-align:center; box-shadow:0 2px 4px rgba(0,0,0,.35); min-width:64px; }
.signpost .board .lvl { color:#c92a2a; }
.signpost .pole { width:5px; height:34px; background:linear-gradient(90deg,#8a5a2b,#6b4220); border-radius:2px; }
.signpost.done .board { background:#ced4da; color:#666; }
.signpost:active { transform:translate(-50%,-100%) scale(.95); }

/* Quests */
.questRow { display:flex; align-items:center; gap:8px; background:#fff8e1; border:2px solid #d0a53c; border-radius:12px; padding:8px 10px; margin-bottom:8px; }
.questRow .qinfo { flex:1; font-size:13px; }
.questRow .qinfo b { font-size:14px; }
.claimBtn { background:linear-gradient(#69db7c,#2f9e44); color:#fff; border:2px solid #1e7a30; border-radius:10px; padding:6px 14px; font-weight:bold; cursor:pointer; }
.claimBtn:disabled { background:#adb5bd; border-color:#868e96; }

/* Tutorial */
.tutBox { background:linear-gradient(#4dabf7,#1c7ed6); border:3px solid #dbe4ff; border-radius:18px; max-width:340px; padding:24px 20px;
  color:#fff; font-size:16px; line-height:2; text-align:center; box-shadow:0 8px 24px rgba(0,0,0,.6); }
.tutBox .bigBtn { margin-top:14px; margin-bottom:0; }

/* Toast */
#toast { position:fixed; bottom:120px; left:50%; transform:translateX(-50%); z-index:40; background:#000000cc; color:#ffd43b;
  border-radius:12px; padding:10px 18px; font-size:14px; font-weight:bold; pointer-events:none; }

/* Train rows */
.trainRow { display:flex; align-items:center; gap:8px; background:#fff8e1; border:2px solid #d0a53c; border-radius:12px; padding:8px 10px; margin-bottom:8px; }
.trainRow .ic { font-size:26px; }
.trainRow .tinfo { flex:1; font-size:12px; color:#5b3a00; }
.trainRow .tinfo b { font-size:14px; }
.trainRow .have { font-size:11px; color:#2b8a3e; }

/* Scout bar */
#scoutbar { position:fixed; top:60px; left:50%; transform:translateX(-50%); z-index:25; background:#000000cc; color:#fff;
  border-radius:12px; padding:8px 12px; display:flex; gap:10px; align-items:center; font-size:13px; max-width:94vw; flex-wrap:wrap; justify-content:center; }
#scoutTimer { color:#ffd43b; font-weight:bold; font-size:15px; direction:ltr; }
#attackBtn { background:linear-gradient(#ff8787,#e03131); color:#fff; border:2px solid #8f1d1d; border-radius:10px; padding:7px 16px; font-weight:bold; cursor:pointer; font-size:14px; }
#retreatBtn { background:#495057; color:#fff; border:none; border-radius:10px; padding:7px 12px; cursor:pointer; font-size:13px; }

@media (max-width:600px) {
  #topbar { gap:3px; }
  .resChip { min-width:45px; font-size:10px; padding:2px 3px; }
  .resIcon { font-size:12px; }
  #playerCard { transform:scale(.85); transform-origin:top left; }
}

@media (max-width:600px) {
  .unitCard { width:46px; height:54px; font-size:17px; }
  #raidTimer { font-size:13px; padding:6px 8px; }
  #endWarBtn { padding:10px 10px; font-size:12px; }
}
