/* =========================================================
   station5Rhythm.css
   תחנה 5, שלב ג' - קצב השמחה. ארבעה כלי נגינה גדולים בשורה, לוח
   צופן (צורה->כלי) גלוי תמיד, מד "השמחה מתעוררת" (45 שניות).
   ========================================================= */

/* ===================== פסיפס מוקטן, נשאר גלוי לאורך כל השלב ===================== */
/* משתמש במחלקות mosaic-wrap/mosaic-zone/mosaic-shadow-shape המוגדרות
   ב-station5ShadowCipher.css - כאן רק דריסת מיקום/גודל וקיבוע
   is-correct (כל ארבעת האזורים כבר פתורים בהכרח כדי להגיע לשלב הזה). */

.rhythm-mini-mosaic.mosaic-wrap {
  position: absolute;
  left: 15%;
  top: 30%;
  transform: translate(-50%, -50%);
  width: clamp(110px, 13vw, 170px);
  z-index: 1;
  pointer-events: none;
}

/* ===================== לוח הצופן שהתגלה (תמיד גלוי) ===================== */

.rhythm-cipher-readout {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: clamp(78px, 12vh, 108px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 16px);
  padding: 8px 16px;
  background: rgba(10, 8, 4, 0.6);
  border: 1px solid rgba(210, 170, 110, 0.4);
  border-radius: 10px;
}

.rhythm-cipher-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.rhythm-cipher-chip-shape {
  width: 26px;
  height: 26px;
  color: var(--color-gold);
  filter: drop-shadow(0 0 6px rgba(232, 194, 122, 0.5));
}

.rhythm-cipher-chip-shape svg {
  width: 100%;
  height: 100%;
}

.rhythm-cipher-chip-name {
  font-family: var(--font-body);
  font-size: clamp(0.6rem, 0.72vw, 0.68rem);
  color: var(--color-parchment-dim);
  white-space: nowrap;
}

.rhythm-cipher-arrow {
  color: rgba(210, 170, 110, 0.6);
  font-size: 1.1rem;
}

/* ===================== חוק הפענוח ===================== */

.rhythm-rule-text {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: clamp(142px, 20vh, 178px);
  transform: translateX(-50%);
  margin: 0;
  width: min(560px, 92%);
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.74rem, 0.9vw, 0.86rem);
  line-height: 1.5;
  color: var(--color-parchment-dim);
  background: rgba(10, 8, 4, 0.5);
  border: 1px solid rgba(210, 170, 110, 0.3);
  padding: 6px 14px;
  border-radius: 8px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

/* ===================== מד "השמחה מתעוררת" ===================== */

.rhythm-joy-meter-wrap {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: clamp(4px, 0.8vh, 10px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(260px, 60vw);
}

.rhythm-joy-meter-label {
  font-family: var(--font-body);
  font-size: clamp(0.62rem, 0.76vw, 0.7rem);
  color: var(--color-parchment-dim);
  white-space: nowrap;
}

.rhythm-joy-meter-track {
  flex: 1;
  height: 8px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(210, 170, 110, 0.3);
  overflow: hidden;
}

.rhythm-joy-meter-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #e8c27a, #ffdf9e);
  transition: width 200ms linear;
}

.rhythm-joy-meter-fill.is-critical {
  background: linear-gradient(90deg, #d86e5b, #f2a58c);
}

/* ===================== התקדמות ברצף (7 נקודות) ===================== */

.rhythm-sequence-progress {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: clamp(230px, 30vh, 270px);
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.rhythm-progress-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(210, 170, 110, 0.25);
  border: 1px solid rgba(210, 170, 110, 0.4);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.rhythm-progress-dot.is-done {
  background: var(--color-gold);
  box-shadow: 0 0 8px rgba(232, 194, 122, 0.8);
}

.rhythm-progress-dot.is-segment-boundary {
  margin-inline-end: 6px;
}

/* ===================== כלי הנגינה ===================== */

.rhythm-instruments-row {
  position: absolute;
  left: 50%;
  bottom: clamp(70px, 12vh, 110px);
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: flex-end;
  gap: clamp(16px, 2.6vw, 36px);
}

.rhythm-instrument-btn {
  position: relative;
  width: clamp(76px, 8.4vw, 128px);
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.rhythm-instrument-btn img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6));
  transition: filter 0.2s ease;
}

.rhythm-instrument-btn:hover:not(:disabled) img,
.rhythm-instrument-btn:focus-visible:not(:disabled) img {
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 14px rgba(232, 194, 122, 0.55));
}

.rhythm-instrument-btn.is-correct-flash img {
  animation: rhythmCorrectFlash 380ms ease;
}

@keyframes rhythmCorrectFlash {
  0% { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 4px rgba(255, 214, 130, 0.4)); transform: scale(1); }
  45% { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 26px rgba(255, 214, 130, 0.95)); transform: scale(1.08); }
  100% { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); transform: scale(1); }
}

.rhythm-instrument-btn.is-wrong-flash img {
  animation: rhythmWrongFlash 380ms ease;
}

@keyframes rhythmWrongFlash {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .rhythm-instrument-btn.is-correct-flash img,
  .rhythm-instrument-btn.is-wrong-flash img {
    animation: none !important;
  }
}

.rhythm-instrument-btn:disabled {
  cursor: default;
  opacity: 0.75;
}

.rhythm-instrument-key {
  position: absolute;
  left: 50%;
  bottom: -1.6em;
  transform: translateX(-50%);
  font-family: var(--font-heading);
  font-size: clamp(0.68rem, 0.82vw, 0.78rem);
  color: var(--color-parchment-dim);
  background: rgba(10, 8, 4, 0.55);
  border: 1px solid rgba(210, 170, 110, 0.35);
  padding: 1px 8px;
  border-radius: 5px;
}

.rhythm-instrument-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(10, 8, 4, 0.75);
  border: 1.5px solid rgba(210, 170, 110, 0.55);
  color: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.rhythm-instrument-badge svg {
  width: 100%;
  height: 100%;
}

/* ===================== רמז: תריס/כלי הבא ===================== */

.rhythm-instrument-btn.is-hint-target img {
  animation: rhythmHintPulse 1300ms ease-in-out infinite;
}

@keyframes rhythmHintPulse {
  0%, 100% { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 8px rgba(232, 194, 122, 0.5)); }
  50% { filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 20px rgba(232, 194, 122, 0.95)); }
}

@media (prefers-reduced-motion: reduce) {
  .rhythm-instrument-btn.is-hint-target img {
    animation: none !important;
  }
}

/* ===================== תיבת האבן (מוצג רק אחרי פתרון) ===================== */

.rhythm-chest-wrap[hidden] {
  display: none;
}

.rhythm-chest-wrap {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: clamp(18px, 3vh, 30px) clamp(20px, 3.4vw, 34px);
  background: linear-gradient(160deg, rgba(23, 20, 12, 0.94) 0%, rgba(12, 10, 6, 0.97) 100%);
  border: 2px solid rgba(210, 170, 110, 0.5);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  text-align: center;
  animation: rhythmChestIn 700ms ease;
}

@keyframes rhythmChestIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.85); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .rhythm-chest-wrap {
    animation: none !important;
  }
}

.rhythm-chest-img {
  width: clamp(160px, 20vw, 260px);
  height: auto;
  filter: drop-shadow(0 0 30px rgba(255, 214, 130, 0.55)) drop-shadow(0 14px 26px rgba(0, 0, 0, 0.6));
}

.rhythm-chest-text {
  margin: 0;
  max-width: 380px;
  font-family: var(--font-body);
  font-size: clamp(0.88rem, 1.05vw, 1rem);
  line-height: 1.6;
  color: var(--color-parchment-dim);
}

.rhythm-reveal-seal-btn {
  font-family: var(--font-heading);
  font-size: clamp(0.9rem, 1.1vw, 1.02rem);
  color: #1a1206;
  background: linear-gradient(180deg, #f3d99a 0%, var(--color-gold) 100%);
  border: 1px solid rgba(0, 0, 0, 0.25);
  padding: 10px 26px;
  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;
}

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

.rhythm-reveal-seal-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

/* מזוהה בפסיפס (אם עדיין מוצג) בזהב, כשהחידה נפתרת - ראו גם
   station5ShadowCipher.css .mosaic-zone.is-correct, המחלקה הזו
   מוסיפה זוהר כולל עדין (לא פוגעת ב"אין אפקטים על כל המסך" - זה
   רק על אלמנט הפסיפס/תיבה עצמם, לא הבזק כללי). */
.mosaic-wrap.is-fully-golden {
  filter: drop-shadow(0 0 30px rgba(255, 214, 130, 0.5));
}
