/* EP06 Player Styling - Lulu's Story Bookshelf (Sequence & Algorithm) */

body.ep06-mode #ep1StartBtn,
body.ep06-mode #ep1RocketFx,
body.ep06-mode #ep1CompleteWrap,
body.ep06-mode #ep2InteractiveLayer,
body.ep06-mode #ep2CompleteWrap,
body.ep06-mode #ep3InteractiveLayer,
body.ep06-mode #ep3CompleteWrap,
body.ep06-mode #ep4InteractiveLayer,
body.ep06-mode #ep4CompleteWrap,
body.ep06-mode #ep5InteractiveLayer,
body.ep06-mode #ep5CompleteWrap {
  display: none !important;
}

#ep6InteractiveLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  overflow: clip;
}

body:not(.ep06-mode) #ep6InteractiveLayer {
  display: none !important;
}

/* Bookshelf Container (Positioned at bottom-right corner to protect Lulu and library bookshelves) */
#ep6ShelfWrap {
  position: absolute;
  bottom: 12px;
  right: 20px;
  left: auto;
  transform: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(139, 92, 246, 0.4);
  border-radius: 20px;
  padding: 10px 18px;
  pointer-events: auto;
  box-shadow: 0 12px 32px rgba(109, 40, 217, 0.35);
  z-index: 25;
  max-width: 440px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#ep6ShelfWrap.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

.ep6-shelf-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.ep6-section-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ddd6fe;
}

.ep6-slots-row {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 14px);
  justify-content: center;
  min-height: 84px;
}

.ep6-slot {
  width: clamp(68px, 16vw, 88px);
  height: clamp(78px, 18vw, 98px);
  border-radius: 12px;
  border: 2px dashed rgba(196, 181, 253, 0.5);
  background: rgba(30, 27, 75, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #c4b5fd;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ep6-slot.filled {
  border-style: solid;
  border-color: #a78bfa;
  background: transparent;
}

.ep6-cards-row {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 14px);
  justify-content: center;
  min-height: 84px;
}

.ep6-book-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(68px, 16vw, 88px);
  height: clamp(78px, 18vw, 98px);
  border-radius: 12px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border: 2px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
  color: #ffffff;
  text-align: center;
  padding: 4px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  user-select: none;
}

.ep6-book-card:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.6);
}

.ep6-book-card.in-slot {
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  border-color: #c7d2fe;
}

.ep6-book-card.correct {
  background: linear-gradient(135deg, #34d399, #059669);
  border-color: #6ee7b7;
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.8);
}

.ep6-book-card.placed {
  background: linear-gradient(135deg, #34d399, #059669);
  border-color: #6ee7b7;
}

.ep6-book-num {
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 9999px;
  padding: 1px 6px;
  margin-bottom: 2px;
}

.ep6-book-icon {
  font-size: 1.5rem;
}

.ep6-book-title {
  font-size: 0.74rem;
  font-weight: 700;
  margin-top: 2px;
  white-space: nowrap;
}

.ep6-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.ep6-check-btn {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border: 2px solid #ffffff;
  border-radius: 9999px;
  padding: 6px 20px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.5);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ep6-check-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.7);
}

.ep6-reset-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e0e7ff;
  cursor: pointer;
  min-height: 42px;
  transition: all 0.2s ease;
}

.ep6-reset-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.ep6-shelf-shake {
  animation: ep6Shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes ep6Shake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* EP06 Completion Card */
#ep6CompleteWrap {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(245, 243, 255, 0.96), rgba(237, 233, 254, 0.96));
  border: 2px solid #8b5cf6;
  border-radius: 20px;
  padding: 16px 24px;
  margin: 12px auto;
  max-width: 580px;
  width: 92%;
  box-shadow: 0 12px 28px rgba(109, 40, 217, 0.2);
  text-align: center;
  z-index: 30;
}

#ep6CompleteWrap.active {
  display: flex !important;
  animation: ep6SlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ep6SlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.ep6-complete-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #5b21b6;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ep6-complete-desc {
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.4;
}

.ep6-complete-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.ep6-btn-secondary {
  background: #ffffff;
  color: #6d28d9;
  border: 1.5px solid #8b5cf6;
  border-radius: 9999px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ep6-btn-secondary:hover {
  background: #f5f3ff;
  transform: translateY(-2px);
}

.ep6-btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  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(109, 40, 217, 0.4);
  transition: all 0.2s ease;
}

.ep6-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(109, 40, 217, 0.55);
}

@media (max-width: 640px) {
  #ep6InteractiveLayer {
    position: static;
    pointer-events: auto;
    height: auto;
  }
  #ep6ShelfWrap {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin: 10px auto 0;
    box-sizing: border-box;
    padding: 10px 12px;
    gap: 8px;
  }
  #ep6ShelfWrap.hidden {
    display: none;
  }
  .ep6-book-card {
    width: 58px;
    height: 68px;
    min-width: 58px;
    min-height: 68px;
  }
  .ep6-book-icon {
    font-size: 1.25rem;
  }
  .ep6-book-title {
    font-size: 0.65rem;
  }
}
