/* =========================================================
   station3Measurement.css
   שלב ב׳ - מידת המים: שני כדים (3/5) על גבי משטח האבן הקדמי.
   ========================================================= */

.measurement-panel {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  width: min(760px, 92%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.4vh, 16px);
}

.measurement-basin {
  position: absolute;
  left: 50%;
  bottom: -6%;
  transform: translateX(-50%);
  width: 120%;
  height: 60%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse 60% 100% at 50% 50%, rgba(60, 170, 190, 0.18) 0%, rgba(60, 170, 190, 0) 70%);
  pointer-events: none;
}

.jugs-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(28px, 5vw, 70px);
}

.measurement-basin-icon {
  align-self: center;
  width: clamp(30px, 3vw, 44px);
  height: clamp(30px, 3vw, 44px);
  opacity: 0.55;
  background: radial-gradient(circle, rgba(150, 220, 230, 0.5) 0%, rgba(150, 220, 230, 0) 70%);
  border-radius: 50%;
}

.jug-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  outline: none;
}

.jug-unit:focus-visible .jug-visual {
  box-shadow: 0 0 0 3px var(--color-gold);
  border-radius: 10px;
}

.jug-visual {
  position: relative;
  width: clamp(110px, 9.5vw, 160px);
}

.jug-unit-5 .jug-visual { width: clamp(96px, 8.4vw, 140px); }
.jug-unit-3 .jug-visual { width: clamp(128px, 11vw, 190px); }

.jug-img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.55));
}

/* מסכת גזירה מקורבת לחלל הפנימי של כל כד (פוליגון מוערך ידנית לפי
   התמונה בפועל - קירוב חזותי, לא מיפוי אלפא מדויק). המילוי עצמו
   הוא ילד פנימי שגובהו נקבע ב-JS לפי אחוז המילוי הנוכחי. */
.jug-water-clip {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
}

.jug-water-clip-5 {
  clip-path: polygon(26% 5%, 72% 5%, 75% 51%, 65% 79%, 34% 79%, 25% 51%);
}

.jug-water-clip-3 {
  clip-path: polygon(17.7% 5%, 73.2% 5%, 79.4% 54%, 68% 79%, 22% 79%, 11.6% 54%);
}

.jug-water-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(180deg, rgba(150, 232, 240, 0.92) 0%, rgba(56, 168, 196, 0.92) 18%, rgba(28, 120, 158, 0.94) 100%);
  transition: height 420ms cubic-bezier(0.3, 0.7, 0.4, 1);
}

.jug-water-fill::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.15));
  background-size: 200% 100%;
  animation: jugWaterShimmer 2600ms linear infinite;
}

@keyframes jugWaterShimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

@media (prefers-reduced-motion: reduce) {
  .jug-water-fill { transition: height 1ms linear; }
  .jug-water-fill::before { animation: none !important; }
}

/* בחירה חזקה וברורה (כד שנבחר להעברה) - מסגרת כחול-זהב עוצמתית,
   לא ניתנת לפספוס. */
.jug-unit.is-target-highlight .jug-visual {
  filter: drop-shadow(0 0 6px rgba(150, 235, 245, 0.95)) drop-shadow(0 0 16px rgba(232, 194, 122, 0.85));
}

.jug-unit.is-target-highlight .jug-visual::after {
  content: "";
  position: absolute;
  inset: -8%;
  border-radius: 14px;
  border: 3px solid;
  border-image: linear-gradient(135deg, #8fe7f5, #e8c27a) 1;
  animation: jugSelectedPulse 1100ms ease-in-out infinite;
  pointer-events: none;
}

@keyframes jugSelectedPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* פעימה על הכד *השני* בזמן שכד אחד נבחר - "לחצו עליי כדי להעביר" */
.jug-unit.is-pour-suggestion .jug-visual {
  animation: jugPourSuggestionPulse 1000ms ease-in-out infinite;
}

@keyframes jugPourSuggestionPulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(232, 194, 122, 0.4)); }
  50% { filter: drop-shadow(0 0 16px rgba(232, 194, 122, 0.9)); }
}

@media (prefers-reduced-motion: reduce) {
  .jug-unit.is-target-highlight .jug-visual::after,
  .jug-unit.is-pour-suggestion .jug-visual {
    animation: none !important;
  }
}

/* תווית "נבחר להעברה" - מעל הכד שנבחר */
.jug-selected-badge[hidden] {
  display: none;
}

.jug-selected-badge {
  display: block;
  margin-bottom: 2px;
  padding: 3px 12px;
  font-family: var(--font-heading);
  font-size: clamp(0.7rem, 0.85vw, 0.8rem);
  color: #d8fbff;
  background: rgba(6, 9, 10, 0.78);
  border: 1px solid rgba(150, 235, 245, 0.6);
  border-radius: 6px;
  animation: jugBadgeIn 200ms ease;
}

@keyframes jugBadgeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.jug-unit.is-glowing .jug-water-fill {
  box-shadow: 0 0 22px 6px rgba(150, 235, 245, 0.9) inset;
  animation: jugGlowPulse 900ms ease-in-out infinite;
}

@keyframes jugGlowPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

@media (prefers-reduced-motion: reduce) {
  .jug-unit.is-glowing .jug-water-fill { animation: none !important; }
}

.jug-status-text {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(0.78rem, 0.95vw, 0.9rem);
  color: var(--color-parchment);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

/* גדול וברור, על רקע פס כהה - לא טקסט קטן צף מעל תמונת הרקע. */
.jug-status-text-big {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  font-weight: 700;
  color: var(--color-gold);
  padding: 5px 16px;
  border-radius: 7px;
  background: rgba(6, 9, 10, 0.68);
  border: 1px solid rgba(216, 164, 91, 0.4);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.jug-controls {
  display: flex;
  gap: 8px;
}

.jug-btn {
  padding: 6px 16px;
  font-family: var(--font-heading);
  font-size: clamp(0.78rem, 0.95vw, 0.88rem);
  color: var(--color-gold);
  background: rgba(8, 6, 4, 0.45);
  border: 1.5px solid rgba(216, 164, 91, 0.55);
  border-radius: 5px;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.jug-btn:hover,
.jug-btn:focus-visible {
  border-color: var(--color-gold);
  box-shadow: 0 0 12px rgba(232, 194, 122, 0.45);
}

.jug-btn[disabled] {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

/* clone גרירה בזמן העברת כד - שכבה קבועה מעל הכול */
.measurement-drag-layer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
}

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

.jug-unit.is-drag-source {
  opacity: 0.35;
}

.jug-unit.is-pour-target {
  filter: drop-shadow(0 0 16px rgba(150, 235, 245, 0.75));
}

.measurement-pour-instruction {
  margin: 0;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.74rem, 0.9vw, 0.84rem);
  color: var(--color-parchment-dim);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

.measurement-history {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 22px;
}

.measurement-history-item {
  padding: 3px 10px;
  font-size: 0.74rem;
  font-family: var(--font-body);
  color: var(--color-parchment-dim);
  background: rgba(6, 9, 10, 0.5);
  border: 1px solid rgba(120, 200, 210, 0.2);
  border-radius: 12px;
  opacity: 0.85;
  animation: historyItemIn 260ms ease;
}

@keyframes historyItemIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 0.85; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .measurement-history-item { animation: none !important; }
}

.measurement-reset-btn {
  padding: 7px 20px;
  font-family: var(--font-heading);
  font-size: clamp(0.8rem, 0.95vw, 0.9rem);
  color: var(--color-parchment-dim);
  background: transparent;
  border: 1px solid rgba(216, 164, 91, 0.4);
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.measurement-reset-btn:hover,
.measurement-reset-btn:focus-visible {
  color: var(--color-gold);
  border-color: var(--color-gold);
}

.measurement-rescue-btn[hidden] {
  display: none;
}

.measurement-rescue-btn {
  padding: 7px 20px;
  font-family: var(--font-heading);
  font-size: clamp(0.8rem, 0.95vw, 0.9rem);
  color: #8fe7f5;
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid rgba(120, 220, 235, 0.6);
  border-radius: 5px;
  cursor: pointer;
  animation: rescueSingleBtnIn 300ms ease;
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.measurement-rescue-btn:hover,
.measurement-rescue-btn:focus-visible {
  color: #fff;
  border-color: #8fe7f5;
  box-shadow: 0 0 12px rgba(120, 220, 235, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .measurement-rescue-btn { animation: none !important; }
}

/* ===================== כרטיס הוראות קבוע ===================== */

.measurement-instructions-card {
  position: absolute;
  z-index: 3;
  top: clamp(70px, 11vh, 96px);
  right: clamp(10px, 2vw, 26px);
  width: min(230px, 26vw);
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(6, 9, 10, 0.74);
  border: 1px solid rgba(216, 164, 91, 0.35);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: opacity 300ms ease;
}

.measurement-instructions-card.is-solved-hidden {
  opacity: 0;
  pointer-events: none;
}

.measurement-instructions-card p {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(0.64rem, 0.78vw, 0.74rem);
  line-height: 1.5;
  color: var(--color-parchment);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.measurement-instructions-card strong {
  font-family: var(--font-heading);
  color: var(--color-gold);
  font-weight: 700;
}

/* ===================== קלף הסבר ראשוני (חד-פעמי) ===================== */

.measurement-intro-overlay[hidden] {
  display: none;
}

.measurement-intro-overlay:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.measurement-intro-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 6, 0.78);
}

.measurement-intro-card {
  position: relative;
  z-index: 1;
  width: min(440px, 88%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 26px 28px;
  text-align: center;
  background: linear-gradient(160deg, #2c2416 0%, #1a140c 100%);
  border: 2px solid rgba(216, 164, 91, 0.6);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.measurement-intro-card h3 {
  margin: 0;
  font-family: var(--font-heading);
  color: var(--color-gold);
  font-size: 1.2rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.measurement-intro-text {
  margin: 0;
  color: var(--color-parchment);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ===================== רמז חזותי: פעימה על כפתור "מלאו"/"רוקנו" ===================== */

.jug-btn.is-hint-pulse {
  animation: jugBtnHintPulse 900ms ease-in-out infinite;
  border-color: var(--color-gold);
}

@keyframes jugBtnHintPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(232, 194, 122, 0); }
  50% { box-shadow: 0 0 14px 3px rgba(232, 194, 122, 0.7); }
}

@media (prefers-reduced-motion: reduce) {
  .jug-btn.is-hint-pulse { animation: none !important; }
}

/* ===================== רמז חזותי: חץ בין כדים ===================== */

.measurement-hint-arrow {
  position: absolute;
  z-index: 5;
  width: 34px;
  height: 34px;
  color: #6fe0ef;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
  pointer-events: none;
  animation: measurementArrowBob 900ms ease-in-out infinite;
}

.measurement-hint-arrow svg { width: 100%; height: 100%; }

@keyframes measurementArrowBob {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .measurement-hint-arrow { animation: none !important; }
}

/* טיפה "רוחנית" הזורמת בין כד למשנהו - הדגמת מזיגה, לא נוגעת בערכים האמיתיים */
.measurement-ghost-drop {
  position: fixed;
  z-index: 21;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 245, 250, 0.95) 0%, rgba(90, 200, 220, 0.7) 70%);
  box-shadow: 0 0 8px 2px rgba(150, 235, 245, 0.6);
  pointer-events: none;
  transition: transform 900ms cubic-bezier(0.3, 0.4, 0.4, 1), opacity 900ms ease;
  opacity: 0;
}

.measurement-ghost-drop.is-flying {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .measurement-ghost-drop {
    transition: opacity 1ms linear !important;
  }
}
