/* Tutorial System Styles - Retro Arcade Theme */

/* ============================================
   Tutorial Overlay Container
   ============================================ */

.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
}

.tutorial-overlay.hidden {
  display: none;
}

/* ============================================
   Dimmer Background
   ============================================ */

.tutorial-dimmer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: auto;
  z-index: 9999;
}

/* ============================================
   Spotlight (Cutout Effect)
   ============================================ */

.tutorial-spotlight {
  position: absolute;
  border-radius: 8px;
  box-shadow:
    0 0 0 9999px rgba(10, 11, 15, 0.75),
    0 0 30px 10px rgba(244, 162, 97, 0.4),
    inset 0 0 20px rgba(244, 162, 97, 0.2);
  pointer-events: none;
  z-index: 10000;
  animation: tutorialSpotlightPulse 2s ease-in-out infinite;
}

@keyframes tutorialSpotlightPulse {
  0%, 100% {
    box-shadow:
      0 0 0 9999px rgba(10, 11, 15, 0.75),
      0 0 30px 10px rgba(244, 162, 97, 0.4),
      inset 0 0 20px rgba(244, 162, 97, 0.2);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(10, 11, 15, 0.75),
      0 0 45px 15px rgba(244, 162, 97, 0.6),
      inset 0 0 25px rgba(244, 162, 97, 0.3);
  }
}

/* ============================================
   Text Box
   ============================================ */

.tutorial-text-box {
  position: absolute;
  background: linear-gradient(180deg, #2b2d42 0%, #1a1d28 100%);
  border: 4px solid #f4a261;
  border-radius: 8px;
  padding: 20px 25px;
  max-width: 380px;
  min-width: 280px;
  z-index: 10001;
  pointer-events: none;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 4px 0 0 #bc6c25,
    0 6px 0 0 #14151f,
    0 0 40px rgba(244, 162, 97, 0.25),
    0 10px 30px rgba(0, 0, 0, 0.5);

  animation: tutorialTextBoxFadeIn 0.3s ease-out;
}

/* Scanline overlay */
.tutorial-text-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
  pointer-events: none;
  border-radius: 4px;
}

.tutorial-text-box-minimal {
  background: linear-gradient(180deg, rgba(43, 45, 66, 0.9) 0%, rgba(26, 29, 40, 0.9) 100%);
  border-width: 2px;
  padding: 15px 20px;
  max-width: 300px;
  min-width: 200px;
}

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

.tutorial-title {
  font-family: "Muro", sans-serif;
  color: #f4a261;
  font-size: 1.4rem;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-shadow:
    0 0 10px rgba(244, 162, 97, 0.5),
    0 2px 0 rgba(0, 0, 0, 0.3);
}

.tutorial-message {
  color: #edf2f4;
  font-family: "Muro", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.tutorial-progress {
  color: #74c7ec;
  font-family: "Muro", sans-serif;
  font-size: 0.9rem;
  margin: 10px 0 0 0;
  text-shadow: 0 0 8px rgba(116, 199, 236, 0.5);
}

.tutorial-progress.hidden {
  display: none;
}

/* Block image in tutorial popup */
.tutorial-block-image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px 0 5px 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 2px solid rgba(244, 162, 97, 0.3);
}

.tutorial-block-image-container.hidden {
  display: none;
}

.tutorial-block-image {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* ============================================
   Arrow
   ============================================ */

.tutorial-arrow {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 10001;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

/* Arrow pointing down (element is below) */
.tutorial-arrow-down {
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 25px solid #f4a261;
  transform: translateX(-50%);
  animation: tutorialArrowBounceDown 1s ease-in-out infinite;
}

/* Arrow pointing up (element is above) */
.tutorial-arrow-up {
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-bottom: 25px solid #f4a261;
  transform: translateX(-50%);
  animation: tutorialArrowBounceUp 1s ease-in-out infinite;
}

/* Arrow pointing left (element is to the left) */
.tutorial-arrow-left {
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-right: 25px solid #f4a261;
  transform: translateY(-50%);
  animation: tutorialArrowBounceLeft 1s ease-in-out infinite;
}

/* Arrow pointing right (element is to the right) */
.tutorial-arrow-right {
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 25px solid #f4a261;
  transform: translateY(-50%);
  animation: tutorialArrowBounceRight 1s ease-in-out infinite;
}

@keyframes tutorialArrowBounceDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(10px); }
}

@keyframes tutorialArrowBounceUp {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-10px); }
}

@keyframes tutorialArrowBounceLeft {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(-10px); }
}

@keyframes tutorialArrowBounceRight {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(10px); }
}

/* ============================================
   Curved Arrow (for drag-drop steps)
   ============================================ */

.tutorial-curved-arrow {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

@keyframes curvedArrowDraw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes curvedArrowHeadFade {
  to {
    opacity: 1;
  }
}

@keyframes curvedArrowPulse {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 10px rgba(244, 162, 97, 0.4));
  }
  50% {
    opacity: 0.85;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 20px rgba(244, 162, 97, 0.7));
  }
}

/* ============================================
   Glow Effect for Allowed Elements
   ============================================ */

.tutorial-glow {
  position: relative;
  z-index: 10002 !important;
  pointer-events: auto !important;
  animation: tutorialGlowPulse 1.5s ease-in-out infinite !important;
  outline: 3px solid rgba(74, 222, 128, 0.8) !important;
  outline-offset: 3px;
}

@keyframes tutorialGlowPulse {
  0%, 100% {
    box-shadow:
      0 0 15px 5px rgba(74, 222, 128, 0.5),
      0 0 30px 10px rgba(74, 222, 128, 0.3);
    filter: brightness(1.1);
  }
  50% {
    box-shadow:
      0 0 25px 10px rgba(74, 222, 128, 0.7),
      0 0 50px 20px rgba(74, 222, 128, 0.4);
    filter: brightness(1.2);
  }
}

/* ============================================
   Tutorial Prompt Dialog
   ============================================ */

.tutorial-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 11, 15, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeInArcade 0.3s ease-out;
}

.tutorial-prompt {
  position: relative;
  background: linear-gradient(180deg, #2b2d42 0%, #1a1d28 100%);
  border: 4px solid #f4a261;
  border-radius: 8px;
  padding: 30px 40px;
  text-align: center;
  max-width: 450px;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 6px 0 0 #bc6c25,
    0 8px 0 0 #14151f,
    0 0 60px rgba(244, 162, 97, 0.3),
    0 20px 50px rgba(0, 0, 0, 0.6);

  animation: slideUpArcade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tutorial-prompt-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid #8d99ae;
  border-radius: 4px;
  color: #8d99ae;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.15s ease;
  z-index: 1;
}

.tutorial-prompt-close:hover {
  background: rgba(244, 162, 97, 0.2);
  border-color: #f4a261;
  color: #f4a261;
}

/* Scanline overlay */
.tutorial-prompt::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
  pointer-events: none;
  border-radius: 4px;
}

.tutorial-prompt h2 {
  font-family: "Muro", sans-serif;
  color: #f4a261;
  font-size: 1.8rem;
  margin: 0 0 15px 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 15px rgba(244, 162, 97, 0.5),
    0 2px 0 rgba(0, 0, 0, 0.4);
}

.tutorial-prompt p {
  color: #edf2f4;
  font-family: "Muro", sans-serif;
  font-size: 1.1rem;
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.tutorial-prompt-note {
  color: #8d99ae !important;
  font-size: 0.95rem !important;
  margin-bottom: 25px !important;
}

.tutorial-prompt-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.tutorial-prompt-buttons .btn {
  min-width: 140px;
}

/* Animations */
@keyframes fadeInArcade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ============================================
   Difficulty Selector Dialog
   ============================================ */

.difficulty-selector-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 11, 15, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeInArcade 0.3s ease-out;
}

.difficulty-selector {
  position: relative;
  background: linear-gradient(180deg, #2b2d42 0%, #1a1d28 100%);
  border: 4px solid #60a5fa;
  border-radius: 8px;
  padding: 30px 40px;
  text-align: center;
  max-width: 550px;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 6px 0 0 #1e3a8a,
    0 8px 0 0 #14151f,
    0 0 60px rgba(96, 165, 250, 0.3),
    0 20px 50px rgba(0, 0, 0, 0.6);

  animation: slideUpArcade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scanline overlay */
.difficulty-selector::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
  pointer-events: none;
  border-radius: 4px;
}

.difficulty-selector h2 {
  font-family: "Muro", sans-serif;
  color: #60a5fa;
  font-size: 2rem;
  margin: 0 0 25px 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-shadow:
    0 0 15px rgba(96, 165, 250, 0.5),
    0 2px 0 rgba(0, 0, 0, 0.4);
}

.difficulty-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.difficulty-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 30px;
  font-family: "Muro", sans-serif;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.difficulty-btn .difficulty-name {
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.difficulty-btn .difficulty-desc {
  font-size: 0.85rem;
  opacity: 0.8;
  text-transform: none;
  letter-spacing: 0.02em;
}

/* Easy - Green */
.difficulty-btn.difficulty-easy {
  background: linear-gradient(180deg, #34a853 0%, #2d8f47 50%, #1e6b33 100%);
  border: 3px solid #4ade80;
  color: #edf2f4;
  
  box-shadow: 
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 0 #166534,
    0 6px 0 0 #14151f;
  
  text-shadow: 2px 2px 0 #166534;
}

.difficulty-btn.difficulty-easy:hover {
  transform: translateY(-3px);
  border-color: #86efac;
  box-shadow: 
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 7px 0 0 #166534,
    0 9px 0 0 #14151f,
    0 0 25px rgba(74, 222, 128, 0.4);
}

/* Normal - Blue */
.difficulty-btn.difficulty-normal {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  border: 3px solid #60a5fa;
  color: #edf2f4;
  
  box-shadow: 
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 0 #1e3a8a,
    0 6px 0 0 #14151f;
  
  text-shadow: 2px 2px 0 #1e3a8a;
}

.difficulty-btn.difficulty-normal:hover {
  transform: translateY(-3px);
  border-color: #93c5fd;
  box-shadow: 
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 7px 0 0 #1e3a8a,
    0 9px 0 0 #14151f,
    0 0 25px rgba(96, 165, 250, 0.4);
}

/* Hard - Orange */
.difficulty-btn.difficulty-hard {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
  border: 3px solid #fbbf24;
  color: #edf2f4;
  
  box-shadow: 
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 0 #92400e,
    0 6px 0 0 #14151f;
  
  text-shadow: 2px 2px 0 #92400e;
}

.difficulty-btn.difficulty-hard:hover {
  transform: translateY(-3px);
  border-color: #fcd34d;
  box-shadow: 
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 7px 0 0 #92400e,
    0 9px 0 0 #14151f,
    0 0 25px rgba(251, 191, 36, 0.4);
}

/* Nightmare - Red/Dark */
.difficulty-btn.difficulty-nightmare {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
  border: 3px solid #f87171;
  color: #edf2f4;
  
  box-shadow: 
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 4px 0 0 #7f1d1d,
    0 6px 0 0 #14151f;
  
  text-shadow: 2px 2px 0 #7f1d1d;
}

.difficulty-btn.difficulty-nightmare:hover {
  transform: translateY(-3px);
  border-color: #fca5a5;
  box-shadow: 
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 7px 0 0 #7f1d1d,
    0 9px 0 0 #14151f,
    0 0 25px rgba(248, 113, 113, 0.5);
  animation: nightmare-glow 0.5s ease-in-out infinite;
}

@keyframes nightmare-glow {
  0%, 100% {
    box-shadow: 
      inset 0 2px 0 rgba(255, 255, 255, 0.3),
      inset 0 -2px 0 rgba(0, 0, 0, 0.2),
      0 7px 0 0 #7f1d1d,
      0 9px 0 0 #14151f,
      0 0 25px rgba(248, 113, 113, 0.5);
  }
  50% {
    box-shadow: 
      inset 0 2px 0 rgba(255, 255, 255, 0.3),
      inset 0 -2px 0 rgba(0, 0, 0, 0.2),
      0 7px 0 0 #7f1d1d,
      0 9px 0 0 #14151f,
      0 0 40px rgba(248, 113, 113, 0.7);
  }
}

.difficulty-btn:active {
  transform: translateY(2px);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 1px 0 0 currentColor;
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
  .difficulty-selector {
    padding: 25px 30px;
    max-width: 90vw;
  }
  
  .difficulty-selector h2 {
    font-size: 1.5rem;
  }
  
  .difficulty-btn .difficulty-name {
    font-size: 1.2rem;
  }
  
  .difficulty-btn .difficulty-desc {
    font-size: 0.75rem;
  }
  
  .difficulty-btn {
    padding: 14px 25px;
  }
}

/* ============================================
   New Run Warning Dialog
   ============================================ */

.new-run-warning-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 11, 15, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeInArcade 0.3s ease-out;
}

.new-run-warning {
  position: relative;
  background: linear-gradient(180deg, #2b2d42 0%, #1a1d28 100%);
  border: 4px solid #f87171;
  border-radius: 8px;
  padding: 30px 40px;
  text-align: center;
  max-width: 450px;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 6px 0 0 #991b1b,
    0 8px 0 0 #14151f,
    0 0 60px rgba(248, 113, 113, 0.3),
    0 20px 50px rgba(0, 0, 0, 0.6);

  animation: slideUpArcade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scanline overlay */
.new-run-warning::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 4px
  );
  pointer-events: none;
  border-radius: 4px;
}

.new-run-warning h2 {
  font-family: "Muro", sans-serif;
  color: #f87171;
  font-size: 1.8rem;
  margin: 0 0 15px 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 15px rgba(248, 113, 113, 0.5),
    0 2px 0 rgba(0, 0, 0, 0.4);
}

.new-run-warning p {
  color: #edf2f4;
  font-family: "Muro", sans-serif;
  font-size: 1.1rem;
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.new-run-warning-note {
  color: #fca5a5 !important;
  font-size: 0.95rem !important;
  margin-bottom: 25px !important;
}

.new-run-warning-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.new-run-warning-buttons .btn {
  min-width: 140px;
}

/* Mobile responsive */
@media screen and (max-width: 768px) {
  .new-run-warning {
    padding: 25px 30px;
    max-width: 90vw;
  }
  
  .new-run-warning h2 {
    font-size: 1.4rem;
  }
  
  .new-run-warning p {
    font-size: 1rem;
  }
  
  .new-run-warning-buttons {
    flex-direction: column;
    gap: 10px;
  }
  
  .new-run-warning-buttons .btn {
    width: 100%;
  }
}
