/* ---------- משימות ---------- */
/* השורה העליונה, כפתור החזרה והמטבעות מוגדרים ב-gallery.css */
#missions {
  justify-content: flex-start;
  align-items: stretch;
  gap: 1.6vh;
  padding: 3vh 2.5vw 2.5vh;
}
#missions.entering { animation: home-in .8s var(--ease-out) both; }
#missions.active .gal-top > * { animation: gal-drop .7s var(--ease-out) backwards; }
#missions.active .gal-top > :nth-child(2) { animation-delay: .1s; }
#missions.active .gal-top > :nth-child(3) { animation-delay: .2s; }

/* חמש עמודות: ארבע לפי קושי (הראשונה, קל, מימין) ואחריהן המשימות היומיות משמאל */
.mi-board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1vw;
}
.mi-col {
  --lv: #2f9e44;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1vh;
}
.mi-col.lv-2 { --lv: #38a8ff; }
.mi-col.lv-3 { --lv: #ff9a2f; }
.mi-col.lv-4 { --lv: #d36bff; }
.mi-col.lv-d { --lv: #1fd6c1; }

.mi-colhead {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: clamp(30px, 5vh, 50px);
  padding: 0 1vw;
  background: rgba(6, 16, 31, .82);
  box-shadow: inset 0 0 0 3px var(--lv), inset 0 0 0 5px rgba(255, 255, 255, .08);
  clip-path: var(--notch);
}
.mi-level { --u: max(1.7px, .34vh); display: flex; }
.mi-timer { font-size: clamp(8px, 1.5vh, 14px); color: var(--lv); direction: ltr; white-space: nowrap; }
.mi-dias { display: flex; gap: .35vw; direction: ltr; }
.mi-dias i { width: 1.1vh; height: 1.1vh; background: #26354f; transform: rotate(45deg); }
.mi-dias i.on { background: var(--lv); box-shadow: 0 0 .6vh var(--lv); }

.mi-list { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 1vh; }

/* ---------- משימה ---------- */
.mi-tile {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: .8vw;
  padding: 1vh .9vw;
  border: 0;
  color: #fff;
  text-align: right;
  cursor: pointer;
  background: linear-gradient(170deg, rgba(22, 48, 104, .62), rgba(5, 12, 27, .92) 62%);
  box-shadow: inset 0 0 0 3px #1c4fa8, inset 0 0 0 5px rgba(120, 180, 255, .1);
  clip-path: var(--notch);
  transition: transform .25s var(--ease-out), box-shadow .25s, background .25s;
}
/* אנימציית כניסה רק כשהלוח נבנה בכניסה למסך (המחלקה enter), לא אחרי איסוף פרס */
.mi-board.enter .mi-tile { animation: slot-in .55s cubic-bezier(.34, 1.56, .64, 1) calc(.15s + var(--i, 0) * 45ms) backwards; }
body.input-mouse .mi-tile:hover, .mi-tile.nav-focus { transform: translateY(-.4vh); box-shadow: inset 0 0 0 3px #6fb3ff, inset 0 0 0 5px rgba(120, 180, 255, .18); }
.mi-tile.nav-focus { outline: none; box-shadow: inset 0 0 0 3px #ffd54a; }
.mi-tile:active { transform: scale(.98); }

.mi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: .6vh; overflow: hidden; }
.mi-title { --u: max(1.5px, .27vh); display: flex; }
.mi-title .px, .mi-desc .px { max-width: 100%; height: auto; }
.mi-desc { display: flex; flex-direction: column; gap: .2vh; }
.mi-desc .px { --u: max(1.3px, .25vh); }
.mi-prog { display: flex; align-items: center; gap: .6vw; direction: ltr; min-height: 2vh; }
.mi-prog .bar { flex: 1; height: 1.1vh; }
.mi-prog .bar i { background: linear-gradient(180deg, var(--lv), color-mix(in srgb, var(--lv) 60%, #000)); }
.mi-num { font-size: clamp(8px, 1.35vh, 13px); color: #cfe3ff; white-space: nowrap; }
.mi-donetext { --u: max(1.3px, .26vh); display: flex; color: #5fe08a; direction: rtl; }

/* הפרס: מטבעות או חבילה */
.mi-reward {
  flex: none;
  width: clamp(54px, 5.2vw, 90px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5vh;
  padding: .6vh .3vw;
  background: rgba(0, 0, 0, .28);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08);
}
.mi-coin { height: 3.4vh; }
.mi-pack { height: 8vh; max-height: 100%; aspect-ratio: 640 / 930; object-fit: cover; box-shadow: 0 .4vh .8vh rgba(0, 0, 0, .5); }
.mi-amount { font-size: clamp(8px, 1.45vh, 14px); color: #ffd54a; white-space: nowrap; }
.mi-reward.pack { gap: .3vh; }

/* סימון "הושלמה": וי ירוק בפינה */
.mi-check {
  position: absolute;
  top: .6vh;
  left: .6vw;
  width: 3vh;
  height: 3vh;
  background: #2fa85a;
  box-shadow: 0 .3vh 0 rgba(0, 0, 0, .4);
}
.mi-check::after {
  content: '';
  position: absolute;
  left: 34%;
  top: 14%;
  width: 28%;
  height: 52%;
  border: solid #fff;
  border-width: 0 .45vh .45vh 0;
  transform: rotate(40deg);
}

/* מוכנה לאיסוף: זוהרת, עם כפתור קבל */
.mi-tile.ready {
  background: linear-gradient(170deg, rgba(120, 90, 10, .6), rgba(30, 20, 5, .94) 62%);
  box-shadow: inset 0 0 0 3px #ffd54a, inset 0 0 0 5px rgba(255, 235, 150, .25), 0 0 2.4vh rgba(255, 200, 60, .35);
}
.mi-tile.ready:not(.nav-focus) { animation: mi-ready 1.4s ease-in-out infinite; }
@keyframes mi-ready { 50% { filter: brightness(1.18); } }
.mi-claim {
  --u: max(1.4px, .27vh);
  position: absolute;
  bottom: .8vh;
  left: .8vw;
  display: flex;
  padding: .5vh .9vw;
  background: linear-gradient(180deg, #ffe27a, #ffb300);
  box-shadow: inset 0 -.4vh 0 rgba(150, 90, 0, .45), inset 0 0 0 2px #fff3b0;
}
.mi-tile.ready .mi-prog { opacity: .9; }

/* הושלמה: עמומה, בלי קפיצה במעבר עכבר */
.mi-tile.done {
  cursor: default;
  background: linear-gradient(170deg, rgba(20, 70, 44, .45), rgba(5, 14, 12, .92) 62%);
  box-shadow: inset 0 0 0 3px #2c7d4c, inset 0 0 0 5px rgba(120, 255, 170, .08);
}
.mi-tile.done .mi-main, .mi-tile.done .mi-reward { opacity: .55; }
body.input-mouse .mi-tile.done:hover { transform: none; box-shadow: inset 0 0 0 3px #2c7d4c, inset 0 0 0 5px rgba(120, 255, 170, .08); }
.mi-tile.done.nav-focus { box-shadow: inset 0 0 0 3px #ffd54a; }
.mi-tile.claimed { animation: mi-claimed .7s ease-out; }
@keyframes mi-claimed { 0% { filter: brightness(2); transform: scale(1.06); } 100% { filter: none; transform: none; } }
.mi-tile.nope { animation: mi-nope .3s; }
@keyframes mi-nope { 25% { transform: translateX(-.5vw); } 75% { transform: translateX(.5vw); } }

@media (prefers-reduced-motion: reduce) {
  .mi-board.enter .mi-tile, .mi-tile.ready:not(.nav-focus), .mi-tile.claimed, .mi-tile.nope { animation: none !important; }
}

/* יהלומים בנוסף לפרס (משימות קשות) */
.mi-gems { display: flex; align-items: center; gap: .25vw; direction: ltr; }
.mi-gem { height: 2.4vh; }
.mi-gem-amount { color: #9eeaff; }
.mi-reward.has-gems .mi-pack { height: 6vh; }
