/* EP04 Player Styling - Coco's Bridge Debugging (Debug & Inspection) */

body.ep04-mode #ep1StartBtn,
body.ep04-mode #ep1RocketFx,
body.ep04-mode #ep1CompleteWrap,
body.ep04-mode #ep2InteractiveLayer,
body.ep04-mode #ep2CompleteWrap,
body.ep04-mode #ep3InteractiveLayer,
body.ep04-mode #ep3CompleteWrap {
  display: none !important;
}

#ep4InteractiveLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: clip;
}

body:not(.ep04-mode) #ep4InteractiveLayer {
  display: none !important;
}

/* 3 Bridge Blocks Container (Positioned at bottom-right corner to protect left detective Coco) */
#ep4BridgeWrap {
  position: absolute;
  bottom: 16px;
  right: 24px;
  left: auto;
  transform: none;
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 18px);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  padding: 8px 18px;
  pointer-events: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 25;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#ep4BridgeWrap.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

.ep4-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(54px, 12vw, 68px);
  height: clamp(54px, 12vw, 68px);
  min-width: 54px;
  min-height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border: 3px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  font-size: 1.6rem;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.4s ease, border-color 0.4s ease;
  position: relative;
}

.ep4-block:hover {
  transform: scale(1.12) translateY(-3px);
}

.ep4-block.flipped {
  background: linear-gradient(135deg, #fb923c, #ea580c);
  border-color: #fef08a;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.55);
}

.ep4-block.flipped .ep4-arrow {
  transform: rotate(180deg);
  display: inline-block;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ep4-block.fixed {
  background: linear-gradient(135deg, #34d399, #059669);
  border-color: #6ee7b7;
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.8);
}

.ep4-block.fixed .ep4-arrow {
  transform: rotate(0deg);
}

.ep4-block-label {
  position: absolute;
  bottom: -22px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #f8fafc;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

/* Sparkle Burst */
.ep4-spark-particle {
  position: absolute;
  pointer-events: none;
  font-size: 1.6rem;
  animation: ep4SparkAnim 0.8s ease-out forwards;
}

@keyframes ep4SparkAnim {
  0% { transform: translate(0, 0) scale(0.4); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1.3); opacity: 0; }
}

/* EP04 Completion Card */
#ep4CompleteWrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.96), rgba(254, 215, 170, 0.96));
  border: 2px solid #f97316;
  border-radius: 20px;
  padding: 16px 24px;
  margin: 12px auto;
  max-width: 580px;
  width: 92%;
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.2);
  text-align: center;
  z-index: 30;
}

#ep4CompleteWrap.active {
  display: flex !important;
  animation: ep4SlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ep4SlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.ep4-complete-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #9a3412;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ep4-complete-desc {
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.4;
}

.ep4-complete-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.ep4-btn-secondary {
  background: #ffffff;
  color: #ea580c;
  border: 1.5px solid #f97316;
  border-radius: 9999px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ep4-btn-secondary:hover {
  background: #fff7ed;
  transform: translateY(-2px);
}

.ep4-btn-primary {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 8px 22px;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.4);
  transition: all 0.2s ease;
}

.ep4-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.55);
}

@media (max-width: 640px) {
  #ep4BridgeWrap {
    padding: 6px 12px;
    gap: 8px;
    bottom: 10px;
    right: 10px;
    left: auto;
    transform: none;
  }
  .ep4-block {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    font-size: 1.3rem;
  }
}
