/* ==========================================================================
   Design System & Base Styles
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;800&display=swap');

:root {
  --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Color Palette */
  --bg-color-1: #ffffff;
  --bg-color-2: #f8fdff;
  --text-main: #0c0c0e;
  --text-muted: #575762;
  --text-card: #1f1f23;
  --accent-color: #000000;
  
  /* Card Spec */
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
  
  /* Layout */
  --content-max-width: 900px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background: #ffffff;
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.app-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.content-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: var(--content-max-width);
}

/* ==========================================================================
   Typography & Main Title
   ========================================================================== */
.title {
  margin-bottom: 2.5rem;
  user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.logo-img {
  width: 100%;
  max-width: 900px;
  height: auto;
  display: block;
}

/* ==========================================================================
   Dilemma Card
   ========================================================================== */
.dilemma-card {
  width: 100%;
  max-width: 600px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin: 0 auto;
  padding: 0 2rem;
  transition: 
    max-height 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
    opacity 0.4s ease, 
    margin 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
    padding 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  justify-content: center;
  align-items: center;
}

.dilemma-card.show {
  max-height: 250px;
  opacity: 1;
  margin: 0 auto 2.5rem auto;
  padding: 1rem 2rem;
}

.dilemma-text {
  font-size: 1.85rem;
  font-weight: 300;
  line-height: 1.35;
  color: var(--text-main);
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease 0.1s, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

.dilemma-card.show .dilemma-text {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Interactive Buttons
   ========================================================================== */
.generate-btn {
  position: relative;
  width: 320px;
  height: 120px;
  background-color: transparent;
  background-image: url('ejemplo-boton.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  color: #ffffff;
  border: none;
  font-family: var(--font-primary);
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2rem;
  text-decoration: none;
  z-index: 1;
  transition: 
    transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
    filter 0.25s ease;
  user-select: none;
  outline: none;
}

.generate-btn:hover {
  transform: scale(1.03);
  filter: brightness(1.08) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
}

.generate-btn:active {
  transform: scale(0.97);
  filter: brightness(0.92);
}

/* Button child elements positioned above the animated background */
.btn-text {
  position: relative;
  z-index: 2;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-icon {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0;
  opacity: 0;
  transform: translateX(12px);
  margin-left: 0;
  transition: 
    width 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
    opacity 0.25s ease, 
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
    margin-left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-icon svg {
  display: block;
  stroke: currentColor;
  stroke-width: 2.5px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.generate-btn:hover .btn-icon {
  width: 16px;
  opacity: 1;
  transform: translateX(0);
  margin-left: 8px;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 15px 35px rgba(0, 120, 213, 0.3);
  }
  50% {
    box-shadow: 0 15px 35px rgba(0, 120, 213, 0.6), 0 0 0 10px rgba(0, 120, 213, 0);
  }
  100% {
    box-shadow: 0 15px 35px rgba(0, 120, 213, 0.3);
  }
}

/* ==========================================================================
   Floating Icons (Absolute Positioning Canvas)
   ========================================================================== */
.icons-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.icon-wrapper {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-origin: center center;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: auto;
  cursor: grab;
  user-select: none;
}

.icon-wrapper.dragging {
  cursor: grabbing;
  z-index: 100;
}

.icon-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.05));
  will-change: transform;
}

/* Position mapping based on reference image - with translate(-50%, -50%) for perfect viewport centering */
.spaceship { transform: translate(-50%, -50%) translate(-33vw, -28vh); }
.peach { transform: translate(-50%, -50%) translate(-10vw, -38vh); }
.racket { transform: translate(-50%, -50%) translate(12vw, -34vh); }
.rubik { transform: translate(-50%, -50%) translate(-28vw, 5vh); }
.soccer { transform: translate(-50%, -50%) translate(26vw, 10vh); }
.dog { transform: translate(-50%, -50%) translate(-1vw, 28vh); }

/* Custom sizes for visual balance */
.spaceship { width: 320px; height: 320px; }
.peach { width: 290px; height: 290px; }
.racket { width: 290px; height: 290px; }
.rubik { width: 310px; height: 310px; }
.soccer { width: 330px; height: 330px; }
.dog { width: 300px; height: 300px; }

/* Individual Float Animations with Offset & Speed differences */
.physics-enabled .icon-wrapper {
  transition: none !important;
}

.physics-enabled .icon-wrapper img {
  animation: none !important;
}

.spaceship img { animation: float-anim-1 7.2s ease-in-out infinite alternate; }
.peach img { animation: float-anim-2 5.8s ease-in-out infinite alternate; }
.racket img { animation: float-anim-3 6.4s ease-in-out infinite alternate; }
.rubik img { animation: float-anim-2 5.2s ease-in-out infinite alternate; }
.soccer img { animation: float-anim-3 6.8s ease-in-out infinite alternate; }
.dog img { animation: float-anim-1 6.0s ease-in-out infinite alternate; }

/* Float Animation Keyframes */
@keyframes float-anim-1 {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-14px) rotate(4deg); }
}

@keyframes float-anim-2 {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-18px) rotate(-4deg); }
}

@keyframes float-anim-3 {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-10px) rotate(2.5deg); }
}



/* ==========================================================================
   Responsive Design & Media Queries
   ========================================================================== */

/* Tablet & Smaller Layout */
@media (max-width: 1024px) {
  .logo-img {
    max-width: 760px;
  }
  .icon-wrapper {
    width: 120px;
    height: 120px;
  }
  .spaceship { width: 180px; height: 180px; transform: translate(-50%, -50%) translate(-35vw, -30vh); }
  .peach { width: 165px; height: 165px; transform: translate(-50%, -50%) translate(-12vw, -38vh); }
  .racket { width: 165px; height: 165px; transform: translate(-50%, -50%) translate(12vw, -36vh); }
  .rubik { width: 170px; height: 170px; transform: translate(-50%, -50%) translate(-30vw, 10vh); }
  .soccer { width: 185px; height: 185px; transform: translate(-50%, -50%) translate(28vw, 14vh); }
  .dog { width: 170px; height: 170px; transform: translate(-50%, -50%) translate(0vw, 32vh); }
}

/* Mobile Screens (Under 768px) */
@media (max-width: 768px) {
  .app-container {
    padding: 1.5rem;
    overflow-y: auto;
    align-items: center;
    justify-content: center;
  }
  
  .title {
    margin-bottom: 2rem;
  }
  .logo-img {
    max-width: 640px;
  }
  
  .dilemma-card.show {
    margin-bottom: 2rem;
    padding: 1.5rem 1rem;
  }
  
  .dilemma-text {
    font-size: 1.5rem;
  }
 
  .generate-btn {
    width: 270px;
    height: 100px;
    font-size: 1.05rem;
    padding: 0 1.5rem;
  }
 
  /* Reposition icons: distribute around viewport edges to surround content. Keep wrapper pointer-events: none to avoid blocking other elements, but allow clicks on the image itself */
  .icon-wrapper {
    pointer-events: none;
    cursor: default;
  }
  .icon-wrapper img {
    pointer-events: auto;
  }
  .spaceship { width: 220px; height: 220px; left: 15px; top: 30px; transform: none; }
  .racket { width: 200px; height: 200px; left: 42%; top: 15px; transform: translateX(-50%); }
  .peach { width: 200px; height: 200px; right: 15px; left: auto; top: 25px; transform: none; }
  .soccer { width: 220px; height: 220px; left: 10px; bottom: 30px; top: auto; transform: none; }
  .dog { width: 210px; height: 210px; left: 56%; bottom: 15px; top: auto; transform: translateX(-50%); }
  .rubik { width: 210px; height: 210px; right: 15px; left: auto; bottom: 25px; top: auto; transform: none; }
}
 
/* Small Mobile Screens (Under 480px) */
@media (max-width: 480px) {
  .logo-img {
    max-width: 400px;
  }
  
  .dilemma-text {
    font-size: 1.3rem;
  }

  .generate-btn {
    width: 240px;
    height: 90px;
    font-size: 0.95rem;
    padding: 0 1.2rem;
  }
 
  /* Move icons scaled down and distributed to surround content safely inside small mobile viewports */
  .spaceship { width: 180px; height: 180px; left: 10px; top: 25px; transform: none; }
  .racket { width: 160px; height: 160px; left: 42%; top: 10px; transform: translateX(-50%); }
  .peach { width: 160px; height: 160px; right: 10px; left: auto; top: 20px; transform: none; }
  .soccer { width: 180px; height: 180px; left: 10px; bottom: 25px; top: auto; transform: none; }
  .dog { width: 170px; height: 170px; left: 55%; bottom: 10px; top: auto; transform: translateX(-50%); }
  .rubik { width: 170px; height: 170px; right: 10px; left: auto; bottom: 20px; top: auto; transform: none; }
}

/* ==========================================================================
   Analog TV Noise Overlay Effect
   ========================================================================== */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.06;
  will-change: transform;
  animation: noise-move 0.2s steps(4) infinite;
}

@keyframes noise-move {
  0% { transform: translate(0, 0); }
  10% { transform: translate(-1%, -1%); }
  20% { transform: translate(-2%, 1%); }
  30% { transform: translate(1%, -2%); }
  40% { transform: translate(-1%, 3%); }
  50% { transform: translate(-2%, 1%); }
  60% { transform: translate(3%, -1%); }
  70% { transform: translate(2%, 1%); }
  80% { transform: translate(-3%, -2%); }
  90% { transform: translate(1%, 2%); }
  100% { transform: translate(0, 0); }
}
