/* =========================================================
   station6StarRoof.css
   תחנה 6, שלב ב' - "גג שבעת הכוכבים": לוח 5x5 אמיתי בתוך מסגרת עץ/
   ברונזה מרובעת (station6-star-roof-frame.png, מרכז שקוף), ארבעה
   polyominoes שונים בצלליות תת-רשת אמיתיות (לא clip-path על רסטר)
   מעל ארבעה מרקמים (דקל/קנים/זית/ערבה). פריסת המסך כולה ב-CSS Grid
   בארבע שורות (כותרת/לוח/מגש/כפתורים) - לא position:absolute נפרד
   לכל אלמנט.
   ========================================================= */

.starroof-screen-grid {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  row-gap: clamp(8px, 1.4vh, 16px);
  align-content: center;
  padding: clamp(12px, 2vh, 22px) clamp(12px, 3vw, 40px);
}

/* ===================== שורה 1: כותרת + הוראה ===================== */

.starroof-header-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: min(900px, 96%);
  margin: 0 auto;
}

/* *** ניגודיות גבוהה, לפחות 20px ב-1366x768 (דרישה מפורשת) - לבן-
   שמנת על רקע כהה אטום, לא זהב דק ישירות על הרקע. ***/
.starroof-header-row .station6-phase-instruction {
  font-size: clamp(1.25rem, 1.5vw, 1.5rem);
  font-weight: 700;
  color: #fff8ea;
  background: rgba(8, 6, 3, 0.78);
  border: 1px solid rgba(210, 170, 110, 0.35);
  border-radius: 10px;
  padding: 10px 18px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  text-align: center;
  margin: 0;
}

.starroof-subinstruction {
  margin: 0;
  text-align: center;
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 1vw, 0.94rem);
  color: #f0e6d2;
  opacity: 0.88;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

/* ===================== שורה 2: הלוח בתוך המסגרת ===================== */

.starroof-board-row {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.starroof-frame-wrap {
  position: relative;
  width: clamp(300px, 34vh, 460px);
  aspect-ratio: 1 / 1;
  max-width: 94vw;
  max-height: 100%;
}

.starroof-frame-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.5));
}

/* *** מיקום הרשת בדיוק בתוך החלון השקוף של המסגרת - נמדד בפועל
   מהתמונה (לא ניחוש): פתח שקוף בין x=193..1062, y=202..1033 מתוך
   1254x1254 פיקסלים. ***/
.starroof-grid {
  position: absolute;
  left: 15.39%;
  right: 15.31%;
  top: 16.11%;
  bottom: 17.62%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  background: rgba(10, 8, 4, 0.35);
}

.starroof-cell {
  position: relative;
  border: 1px solid rgba(210, 170, 110, 0.22);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.starroof-cell:hover,
.starroof-cell:focus-visible {
  background: rgba(232, 194, 122, 0.1);
  outline: none;
}

/* *** דרישה מפורשת: תצוגה מקדימה חוקית היא זהב/קרם ניטרלי, לא ירוק -
   ירוק מרמז "זה נכון/חלק מהפתרון", וזו בדיוק ההטעיה שאסור לתת. חוקיות
   גיאומטרית בלבד, לא רמז לפתרון. ***/
.starroof-cell.preview-valid {
  background: rgba(232, 194, 122, 0.5) !important;
}

.starroof-cell.preview-invalid {
  background: rgba(210, 80, 70, 0.5) !important;
}

.starroof-cell.is-hint-focus {
  animation: station6BadgePulse 1100ms ease-in-out infinite;
  background: rgba(232, 194, 122, 0.18);
}

.starroof-cell.starroof-ghost-outline {
  box-shadow: inset 0 0 0 2px var(--color-gold);
}

.starroof-cell.is-inert {
  cursor: default;
}

.starroof-cell.starroof-demo-cover {
  background: rgba(140, 170, 220, 0.35);
}

.starroof-cell.starroof-demo-reject {
  background: rgba(220, 90, 80, 0.5);
}

/* *** כוכב-לילה זהוב-כחלחל גדול וברור, לא עיגול ולא כתם - clip-path
   מצולע-כוכב אמיתי, גלוי תמיד. ***/
.starroof-star-icon {
  position: absolute;
  inset: 12%;
  background: linear-gradient(160deg, #cfe0ff 0%, #e8c27a 55%, #d9a24a 100%);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  opacity: 0.85;
  filter: drop-shadow(0 0 6px rgba(180, 210, 255, 0.6));
  pointer-events: none;
}

.starroof-cell.is-lit .starroof-star-icon {
  animation: schachStarTwinkle 1800ms ease-in-out infinite;
  opacity: 1;
}

@keyframes schachStarTwinkle {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(180, 210, 255, 0.6)); }
  50% { filter: drop-shadow(0 0 14px rgba(210, 230, 255, 1)); }
}

/* ===================== תבנית-חלק משותפת (מגש / מונח / גרירה) =====================
   *** צללית מדויקת מתאי-רשת אמיתיים - כל תא ממלא הוא <div> הניתן
   ללחיצה בפועל (pointer-events:auto), כל תא ריק בתוך תיבת-התיחום
   שקוף לגמרי ל-pointer-events וחור-הלחיצה עובר דרכו אל מה שמתחתיו -
   לא הסתמכות על תמונה רסטרית לקביעת אזור-לחיצה. ***/

.starroof-piece-shape {
  display: grid;
  width: 100%;
  height: 100%;
}

.starroof-piece-cell {
  position: relative;
}

.starroof-piece-cell.is-empty {
  pointer-events: none;
  background: none;
}

.starroof-piece-cell.is-filled {
  background-repeat: no-repeat;
  border: 2px solid var(--piece-outline, #d8b25c);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35);
}

/* ===================== שורה 3: מגש ארבעת החלקים ===================== */

.starroof-tray-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.starroof-tray {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(14px, 1.8vw, 26px);
  flex-wrap: wrap;
  padding: 12px 20px;
  border-radius: 10px;
  background: rgba(10, 8, 4, 0.5);
  border: 1px solid rgba(183, 169, 140, 0.3);
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.45);
  max-width: 96%;
}

.starroof-tray-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  background: rgba(30, 22, 12, 0.6);
  border: 2px solid rgba(183, 169, 140, 0.4);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.starroof-tray-card .starroof-piece-shape {
  width: clamp(70px, 6.4vw, 96px);
  height: clamp(90px, 9vh, 130px);
}

.starroof-tray-card:hover:not(:disabled),
.starroof-tray-card:focus-visible {
  border-color: var(--color-gold);
  box-shadow: 0 0 10px rgba(232, 194, 122, 0.4);
}

.starroof-tray-card.is-selected {
  border-color: var(--color-gold);
  box-shadow: 0 0 14px rgba(232, 194, 122, 0.7);
  transform: translateY(-3px);
}

.starroof-tray-card.is-hint-focus {
  animation: station6BadgePulse 1100ms ease-in-out infinite;
  border-color: var(--color-gold);
}

.starroof-tray-card.is-dragging-placeholder {
  opacity: 0.3;
}

.starroof-tray-card:disabled {
  cursor: default;
  opacity: 0.5;
}

/* *** תג שם ברור לכל חלק - הזיהוי אינו תלוי בצבע בלבד. ***/
.starroof-tray-tag {
  font-family: var(--font-body);
  font-size: clamp(0.7rem, 0.84vw, 0.8rem);
  color: var(--color-parchment-dim);
}

.starroof-tray-contact-shadow {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 60%;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 75%);
  z-index: -1;
}

/* ===================== חלקים מונחים על הלוח ===================== */

.starroof-placed-piece {
  position: relative;
  pointer-events: none;
  z-index: 2;
}

.starroof-placed-piece .starroof-piece-cell.is-filled {
  pointer-events: auto;
  cursor: pointer;
}

.starroof-placed-piece.is-selected .starroof-piece-cell.is-filled {
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35), 0 0 10px rgba(232, 194, 122, 0.85);
}

.starroof-placed-piece.is-locked .starroof-piece-cell.is-filled {
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35), 0 0 8px rgba(140, 220, 160, 0.7);
  cursor: default;
}

/* ===================== שורה 4: כפתורי פעולה ===================== */

.starroof-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  width: min(820px, 94%);
  margin: 0 auto;
}

/* ===================== שכבת גרירה ===================== */

.starroof-drag-layer {
  position: fixed;
  inset: 0;
  z-index: 5000;
  pointer-events: none;
}

.starroof-drag-clone {
  position: fixed;
  pointer-events: none;
  opacity: 0.9;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.6));
}

@media (prefers-reduced-motion: reduce) {
  .starroof-tray-card.is-hint-focus,
  .starroof-cell.is-hint-focus,
  .starroof-cell.is-lit .starroof-star-icon {
    animation: none !important;
  }
}
