/* =========================================================
   station5OilLogic.css
   תחנה 5, שלב א' - חשבון המנורות.

   *** סבב כיול: מיקום כל מנורה (left/top בפיקסלים) נקבע כולו ע"י
   station5OilLogic.js (applyLampLayout) בזמן ריצה, מתוך: (א) כיול
   תיבת האלפא האמיתית של station5-golden-lamp.png, (ב) ארבע נקודות
   עיגון שנמדדו על גבי הרקע, (ג) מיפוי מפורש של קנה-המידה/החיתוך
   שיוצר background-size:cover בקונטיינר בפועל. ה-CSS כאן אחראי רק
   על שני דברים קבועים שלא תלויים ברזולוציה: (1) איזה חלק מהריבוע
   הממוקם הוא "העוגן" - transform עם האחוזים המדויקים שנמדדו מתיבת
   האלפא (לא 50%/50% גנרי), ו-(2) גודל יחסי (near/far לפי כיוון). ***
   ========================================================= */

/* ===================== "איך מחלקים את השמן?" - כרטיס לא-מודאלי =====================
   *** אובחן חי (הסבב הזה) ע"י elementFromPoint() בכל נקודה על המסך
   (כדים/מנורות/כפתורים) בזמן שהחלונית פתוחה - כולן החזירו
   .station4-intro-backdrop (שכבה שקופה-בגודל-מסך, pointer-events
   ברירת-מחדל auto, z-index:20 מהעטיפה הישנה station5-intro-overlay)
   שחסמה לגמרי כל לחיצה למשחק כל עוד החלונית פתוחה - "מלכודת קליק
   מתה" אמיתית, לא רק בעיית מצב-בדיקה. התיקון: אין backdrop כלל
   במסך הזה, העטיפה עצמה pointer-events:none (המשחק מתחתיה נשאר
   פעיל לגמרי), ורק הכרטיס עצמו (וכל מה שבתוכו) מקבל pointer-events:
   auto בחזרה. ממוקם בשטח האבן הפנוי במרכז הזירה (המסדרון בין מנורת
   הצפון למנורת המזרח, x בערך 420-946 ב-1366x768) - לא חופף אף
   מנורה/כד/כפתור/לוח-רמזים. רחב ונמוך, בלי גלילה פנימית. ***/

.oil-howto-panel[hidden] {
  display: none;
}

.oil-howto-panel {
  position: absolute;
  z-index: 10;
  top: clamp(150px, 21vh, 190px);
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, 74%);
  pointer-events: none;
}

.oil-howto-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 22px 18px;
  background: rgba(12, 9, 5, 0.94);
  border: 1.5px solid rgba(210, 170, 110, 0.55);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.oil-howto-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(0.92rem, 1.15vw, 1.05rem);
  color: var(--color-gold);
}

.oil-howto-text {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(0.74rem, 0.9vw, 0.84rem);
  line-height: 1.5;
  color: #f0e6d2;
}

.oil-howto-close-btn {
  align-self: center;
  margin-top: 4px;
  padding: 8px 26px;
  font-family: var(--font-heading);
  font-size: clamp(0.82rem, 1vw, 0.92rem);
  font-weight: 700;
  color: #17110a;
  background: var(--color-gold);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.oil-howto-close-btn:hover,
.oil-howto-close-btn:focus-visible {
  box-shadow: 0 0 14px rgba(232, 194, 122, 0.6);
}

/* ===================== לוח רמזים ===================== */
/* *** דרישה: החלונית תמיד בשכבה העליונה ביותר של תוכן המשחק (מעל
   מנורות/כדים/תוויות/צללים) - z-index גבוה במפורש, לא "2" כמו כל
   שאר האלמנטים במסך (זו הייתה הסיבה שהתווית "דרום" הופיעה מעליה). *** */

/* *** תיקון כיול נוסף: החלונית חייבת להישאר כולה מעל השורה שבה
   מתחילות המנורות הקדמיות (דרום/מערב) - אחרת, למרות ה-z-index הנכון
   (שפותר את סדר-השכבות), החלונית "בולעת" חזותית את החלק העליון של
   מנורת הדרום כי שתיהן תופסות את אותו שטח מסך. נמדד בפועל ב-1366x768
   וב-1920x1080 (getBoundingClientRect): פס העל של מנורה קדמית מתחיל
   בסביבות 38.5% מגובה ה-viewport; לכן החלונית מוגבלת כאן לתחום גובה
   קטן בהרבה (לא רק top גבוה יותר, גם max-height מצומצם ורווחים
   פנימיים מהודקים כדי שכל 4 הרמזים עדיין נכנסים בלי גלילה). ***/
.oil-clue-panel {
  position: absolute;
  z-index: 15;
  right: clamp(10px, 2.2vw, 26px);
  top: clamp(42px, 6.3vh, 54px);
  width: clamp(150px, 17vw, 220px);
  max-height: 24vh;
  overflow-y: auto;
  padding: 8px 11px;
  background: rgba(8, 6, 3, 0.92);
  border: 1px solid rgba(210, 170, 110, 0.5);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}

.oil-clue-panel-title {
  margin: 0 0 5px;
  font-family: var(--font-heading);
  font-size: clamp(0.82rem, 1vw, 0.94rem);
  color: var(--color-gold);
  text-align: center;
}

.oil-clue-list {
  margin: 0;
  padding-inline-start: 1.3em;
  list-style: decimal;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.oil-clue-list li {
  font-family: var(--font-body);
  font-size: clamp(0.66rem, 0.8vw, 0.75rem);
  line-height: 1.3;
  color: #f0e6d2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  border-radius: 6px;
  padding: 1px 4px;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.oil-clue-list li.is-hint-focus {
  background: rgba(210, 170, 110, 0.2);
  box-shadow: 0 0 0 1px rgba(210, 170, 110, 0.5);
  animation: oilClueHintPulse 1200ms ease-in-out infinite;
}

@keyframes oilClueHintPulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .oil-clue-list li.is-hint-focus {
    animation: none !important;
  }
}

/* ===================== סדר ההדלקה שנחשף (קבוע, מועבר לשלב ב') ===================== */

.oil-lit-order-display[hidden] {
  display: none;
}

.oil-lit-order-display {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: clamp(78px, 12vh, 108px);
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: 92vw;
  text-align: center;
  font-family: var(--font-heading);
  font-size: clamp(0.78rem, 0.96vw, 0.9rem);
  color: var(--color-gold);
  background: rgba(10, 8, 4, 0.68);
  border: 1px solid rgba(210, 170, 110, 0.45);
  padding: 5px 16px;
  border-radius: 8px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

/* ===================== מנורות ===================== */
/* left/top נקבעים ע"י JS (פיקסלים אמיתיים, מחושבים מכיול הרקע) -
   ה-transform כאן הוא הכיול הקבוע של "היכן העוגן בתוך הריבוע
   הממוקם" - נגזר ישירות מתיבת האלפא הנמדדת של קובץ ה-PNG:
   מרכז-אופקי בפועל = 50.05% (לא 50% גנרי, אם כי כמעט זהה), תחתית
   הרגליים בפועל = 99.089% מגובה הקנבס (לא 100%, יש שוליים שקופים
   קטנים מתחת לרגליים בקובץ המקורי). */

.oil-lamp-wrap {
  position: absolute;
  z-index: 2;
  transform: translate(-50.05%, -99.089%);
  width: clamp(60px, 6.6vw, 98px);
}

/* עומק: העמודים האחוריים (צפון/מזרח) קטנים מעט מהקדמיים (דרום/מערב) -
   "מנורה רחוקה תהיה מעט קטנה יותר ממנורה קרובה". */
.oil-lamp-wrap[data-direction="N"],
.oil-lamp-wrap[data-direction="E"] {
  width: clamp(52px, 5.7vw, 85px);
}

.oil-lamp-wrap[data-direction="S"],
.oil-lamp-wrap[data-direction="W"] {
  width: clamp(66px, 7.3vw, 108px);
}

.oil-lamp-img {
  width: 100%;
  height: auto;
  display: block;
  filter: brightness(0.55) saturate(0.7) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  transition: filter 900ms ease;
  pointer-events: none;
}

.oil-lamp-wrap.is-lit .oil-lamp-img {
  filter: brightness(1.08) saturate(1.1) drop-shadow(0 0 16px rgba(255, 200, 120, 0.65));
}

/* צל מגע מקומי - אליפסה עדינה בדיוק בקו המגע (תחתית תיבת האלפא),
   לא drop-shadow שעוטף את כל התמונה. z-index שלילי כדי לצייר מתחת
   לתמונה הסטטית (ראו הערת סדר השכבות בקובץ ה-JS). */
.oil-lamp-contact-shadow {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 99.089%;
  width: 58%;
  height: 16%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.28) 55%, rgba(0, 0, 0, 0) 78%);
  pointer-events: none;
}

.oil-lamp-flame {
  position: absolute;
  left: 50%;
  top: 4%;
  width: 46%;
  height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(255, 210, 130, 0.95) 0%, rgba(255, 160, 60, 0.5) 45%, rgba(255, 160, 60, 0) 75%);
  z-index: 3;
}

.oil-lamp-wrap.is-lit .oil-lamp-flame {
  opacity: 1;
  animation: oilFlameFlicker 1600ms ease-in-out infinite;
}

@keyframes oilFlameFlicker {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.85; }
  50% { transform: translate(-50%, -55%) scale(1.12); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .oil-lamp-wrap.is-lit .oil-lamp-flame {
    animation: none !important;
  }
}

/* ===================== מגש-כד קטן, צמוד לבסיס כל מנורה ===================== */
/* left/top נקבעים ע"י JS (מיד מתחת לנקודת העיגון) - transform כאן
   ממרכז אופקית בלבד (top כבר מייצג את הקצה העליון של האלמנט). */

.oil-lamp-jugwrap {
  position: absolute;
  z-index: 2;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
}

.oil-lamp-slot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.oil-lamp-slot:not(.is-filled) {
  border: 2px dashed rgba(210, 170, 110, 0.5);
  border-radius: 50%;
  background: rgba(10, 8, 4, 0.35);
  cursor: pointer;
}

.oil-lamp-slot:not(.is-filled):hover,
.oil-lamp-slot:not(.is-filled):focus-visible {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(210, 170, 110, 0.3);
  outline: none;
}

/* ===================== כד מונח במנורה ===================== */

.oil-lamp-jug-btn {
  width: 90%;
  height: 90%;
  padding: 2px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}

.oil-lamp-jug-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

/* *** דרישה מפורשת: זוהר עדין + סמל חזרה קטן ב-hover, cursor:pointer
   (כבר מוגדר למעלה). הסמל מוסתר כברירת מחדל ומופיע ב-hover/focus
   בלבד, כך שלא "מרעיש" את התצוגה כשלא נוגעים בכד. *** */
.oil-lamp-jug-btn:hover:not(:disabled),
.oil-lamp-jug-btn:focus-visible:not(:disabled) {
  outline: none;
}

.oil-lamp-jug-btn:hover:not(:disabled) img,
.oil-lamp-jug-btn:focus-visible:not(:disabled) img {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 10px rgba(232, 194, 122, 0.75));
}

.oil-return-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  height: 46%;
  transform: translate(-50%, -50%);
  color: #fff3d6;
  background: rgba(10, 8, 4, 0.55);
  border-radius: 50%;
  padding: 3px;
  box-sizing: content-box;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}

.oil-lamp-jug-btn:hover:not(:disabled) .oil-return-icon,
.oil-lamp-jug-btn:focus-visible:not(:disabled) .oil-return-icon {
  opacity: 1;
}

.oil-lamp-jug-btn.is-dragging-placeholder {
  opacity: 0.35;
}

.oil-lamp-jug-btn:disabled {
  cursor: default;
}

/* ===================== לוחיות ברונזה לשם הכיוון ===================== */
/* left/top נקבעים ע"י JS (מתחת למגש-הכד, עם מרווח >=8px) - transform
   כאן ממרכז אופקית בלבד. */

.oil-lamp-plaque {
  position: absolute;
  z-index: 2;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 10px;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: clamp(0.66rem, 0.78vw, 0.74rem);
  font-weight: 600;
  color: #f3e6c8;
  background: linear-gradient(180deg, rgba(90, 60, 24, 0.92) 0%, rgba(48, 30, 10, 0.94) 100%);
  border: 1px solid rgba(210, 170, 110, 0.55);
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

/* ===================== שכבת כיול (dev בלבד, כבויה כברירת מחדל) ===================== */

.oil-calib-layer[hidden] {
  display: none;
}

/* תיבת האלפא האמיתית - דריסה ישירה על תמונת המנורה, אחוזים מדויקים
   שנמדדו מהקובץ (לא 0/0/0/0 גנרי): שוליים שקופים אמיתיים בכל צד. */
.oil-calib-bbox {
  position: absolute;
  z-index: 4;
  top: 1.107%;
  bottom: 0.911%;
  left: 16.113%;
  right: 16.016%;
  border: 1.5px dashed #ff5050;
  pointer-events: none;
}

.oil-calib-anchor {
  position: absolute;
  z-index: 30;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #ff3b3b;
  border: 1.5px solid #fff;
  box-shadow: 0 0 6px rgba(255, 59, 59, 0.9);
  pointer-events: none;
}

.oil-calib-surface {
  position: absolute;
  z-index: 29;
  width: 100px;
  height: 2px;
  transform: translateY(-50%);
  background: #2fd7ff;
  box-shadow: 0 0 4px rgba(47, 215, 255, 0.9);
  pointer-events: none;
}

/* ===================== הוראה קבועה + מגש כדי השמן ===================== */

.oil-tray-instruction {
  position: absolute;
  left: 50%;
  bottom: clamp(158px, 21.5vh, 190px);
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  width: max-content;
  max-width: 90vw;
  text-align: center;
  font-family: var(--font-body);
  font-size: clamp(0.7rem, 0.86vw, 0.8rem);
  color: #e8dcc4;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

.oil-jug-tray {
  position: absolute;
  left: 50%;
  bottom: clamp(90px, 13vh, 118px);
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1.6vw, 20px);
  padding: 10px 16px;
  background: rgba(10, 8, 4, 0.55);
  border: 1px solid rgba(210, 170, 110, 0.35);
  border-radius: 12px;
  min-height: clamp(64px, 7.4vw, 92px);
}

.oil-jug-token {
  position: relative;
  padding: 4px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.15s ease;
}

.oil-jug-token[data-size="small"] { width: clamp(34px, 3.6vw, 46px); }
.oil-jug-token[data-size="medium"] { width: clamp(42px, 4.6vw, 58px); }
.oil-jug-token[data-size="large"] { width: clamp(52px, 5.6vw, 70px); }

.oil-jug-token img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.oil-jug-token:hover:not(:disabled),
.oil-jug-token:focus-visible:not(:disabled) {
  filter: drop-shadow(0 0 12px rgba(210, 170, 110, 0.7));
  transform: translateY(-2px);
}

.oil-jug-token.is-selected {
  filter: drop-shadow(0 0 4px var(--color-gold)) drop-shadow(0 0 16px rgba(210, 170, 110, 0.85));
  transform: translateY(-3px);
  animation: oilJugSelectedPulse 1300ms ease-in-out infinite;
}

@keyframes oilJugSelectedPulse {
  0%, 100% { filter: drop-shadow(0 0 4px var(--color-gold)) drop-shadow(0 0 12px rgba(210, 170, 110, 0.65)); }
  50% { filter: drop-shadow(0 0 6px var(--color-gold)) drop-shadow(0 0 22px rgba(210, 170, 110, 0.95)); }
}

@media (prefers-reduced-motion: reduce) {
  .oil-jug-token.is-selected {
    animation: none !important;
  }
}

.oil-jug-token.is-dragging-placeholder {
  opacity: 0.35;
}

.oil-jug-token:disabled {
  cursor: default;
  opacity: 0.6;
}

/* *** דרישה מפורשת: הבדל ברור בין הכדים גם בלי כיתוב - פסי מדידה:
   קטן=1, בינוני=2, גדול=3 - תג עדין בפינת הכד, לא תלוי בגרפיקה
   המקורית (שאינה עקבית בכמות הפסים העיטוריים שלה). *** */
.oil-jug-gauge {
  position: absolute;
  left: 2px;
  bottom: 2px;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  z-index: 2;
  pointer-events: none;
}

.oil-jug-gauge-bar {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-gold);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.8), 0 0 4px rgba(232, 194, 122, 0.6);
}

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

.oil-jug-clone {
  position: fixed;
  z-index: 501;
  pointer-events: none;
}

.oil-jug-clone img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

/* ===================== מד משוב + כפתורי פעולה ===================== */

.oil-feedback-meter {
  position: absolute;
  left: 50%;
  bottom: clamp(52px, 8vh, 74px);
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  width: min(560px, 92vw);
  min-height: 1.4em;
  text-align: center;
  font-family: var(--font-heading);
  font-size: clamp(0.8rem, 0.96vw, 0.9rem);
  color: var(--color-parchment-dim);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.oil-actions {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 2.4vh, 24px);
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
}

.oil-check-btn {
  font-family: var(--font-heading);
  font-size: clamp(0.82rem, 1vw, 0.94rem);
  color: #1a1206;
  background: linear-gradient(180deg, #f3d99a 0%, var(--color-gold) 100%);
  border: 1px solid rgba(0, 0, 0, 0.25);
  padding: 9px 22px;
  border-radius: 9px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.oil-check-btn:hover:not(:disabled),
.oil-check-btn:focus-visible:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 9px 20px rgba(0, 0, 0, 0.5);
}

.oil-check-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

/* *** דרישה: כפתור קטן ולא בולט, לא חלון-אישור - איפוס סידור בלבד. *** */
.oil-reset-all-btn {
  font-family: var(--font-body);
  font-size: clamp(0.68rem, 0.82vw, 0.76rem);
  color: #cfc3a8;
  background: rgba(10, 8, 4, 0.5);
  border: 1px solid rgba(210, 170, 110, 0.3);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.oil-reset-all-btn:hover:not(:disabled),
.oil-reset-all-btn:focus-visible:not(:disabled) {
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.oil-reset-all-btn:disabled {
  cursor: default;
  opacity: 0.5;
}

/* ===================== נעילת רמז 4 (כד ננעל במנורתו) ===================== */

.oil-lamp-slot.is-hint-locked .oil-lamp-jug-btn {
  cursor: default;
}

.oil-lamp-slot.is-hint-locked::after {
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  border: 2px solid var(--color-gold);
  box-shadow: 0 0 10px rgba(232, 194, 122, 0.6);
  pointer-events: none;
}
