/* ============================================================
   פאזל לילדים v2 — CSS
   ============================================================ */

/* מסכים */
.pazel-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  gap: 16px;
  background: linear-gradient(160deg,#fff8ee 0%,#fde8c0 100%);
  box-sizing: border-box;
}
.pazel-screen.active { display: flex; }

/* כרטיס */
.pazel-card {
  background: white;
  border-radius: 18px;
  padding: 18px 22px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 560px;
  box-sizing: border-box;
  direction: rtl;
}
.pazel-card h2 {
  font-size: 1rem;
  color: #7a5030;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #c8a87a;
}

/* תמונות preset */
.preset-thumb {
  cursor: pointer;
  border-radius: 10px;
  border: 3px solid transparent;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 96px;
  background: #f0e4cc;
  transition: transform 0.15s, border-color 0.15s;
}
.preset-thumb img {
  width: 96px; height: 70px;
  object-fit: cover; display: block;
}
.preset-thumb span {
  font-size: 0.7rem; padding: 3px 5px;
  text-align: center; color: #3a2010;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; width: 100%;
}
.preset-thumb:hover { transform: scale(1.06); }
.preset-thumb.selected { border-color: #e07030; box-shadow: 0 0 0 2px #e07030; }

/* כפתורי רמה */
.level-btn {
  padding: 12px 20px;
  border-radius: 14px;
  border: 3px solid #c0a070;
  background: white;
  font-size: 0.95rem;
  font-family: Arial, sans-serif;
  cursor: pointer;
  color: #3a2010;
  min-width: 110px;
  text-align: center;
  transition: all 0.15s;
}
.level-btn:hover { background: #fff0de; border-color: #e07030; }
.level-btn.selected { background: #e07030; border-color: #b85020; color: white; box-shadow: 0 4px 12px rgba(224,112,48,0.4); }

/* תצוגה מקדימה */
#selected-preview img { max-width: 160px; max-height: 120px; border-radius: 8px; border: 2px solid #c0a070; object-fit: contain; }

/* מסך משחק */
#screen-game {
  display: none;
  flex-direction: column;
  padding: 0 !important;
  gap: 0 !important;
  overflow: hidden;
  background: #fef6e8;
  height: 100%;
  flex: 1;
}
#screen-game.active { display: flex !important; }

/* אזור המשחק */
#puzzle-workspace {
  flex: 1 1 0;
  position: relative;
  overflow: hidden;
  background: #f5ead8;
  touch-action: none;
  width: 100%;
  min-height: 0;
}

/* חלקי פאזל */
.jigsaw-piece-wrap {
  position: absolute;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: left, top;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.3));
}
.jigsaw-piece-wrap:hover {
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.45));
  z-index: 999 !important;
}
.jigsaw-piece-wrap.dragging {
  filter: drop-shadow(0 12px 28px rgba(0,0,0,0.55));
  opacity: 0.93;
}
.jigsaw-piece-wrap.piece-correct {
  cursor: default;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.15));
}
.jigsaw-piece-inner {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
}

/* ספינר */
.pazel-spinner {
  width: 44px; height: 44px;
  border: 5px solid #c8a87a;
  border-top-color: #e07030;
  border-radius: 50%;
  animation: pazelSpin 0.8s linear infinite;
}
@keyframes pazelSpin { to { transform: rotate(360deg); } }

/* קונפטי */
.confetti-particle {
  position: fixed;
  top: -20px;
  border-radius: 3px;
  animation: pazelConfetti linear forwards;
  pointer-events: none;
}
@keyframes pazelConfetti {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* אנימציית פופ ניצחון */
@keyframes pazelWinPop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
