body {
  font-family: system-ui, sans-serif;
  background: url('bg.png') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  justify-content: center;
  padding: 15px;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

.app {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: 14px;
  padding: 20px;
  padding-bottom: 40px; /* Space for the bottom buttons */
  box-shadow: 0 20px 40px rgba(0,0,0,.1);
  transition: all 0.5s ease;
  position: relative;
  z-index: 10;
  box-sizing: border-box;
}

.app.wide {
  max-width: 800px;
}

.fade-in {
  animation: fade .5s ease;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

#intro-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: black;
  z-index: 1000;
  transition: opacity 1s ease;
}

#intro-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#start-btn {
  position: relative;
  width: auto;
  padding: 15px 40px;
  font-size: 1.2rem;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

#start-btn:hover {
  transform: scale(1.05);
  background: #4f46e5;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
}

.intro-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.1);
  padding: 40px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#username {
  padding: 15px 25px;
  font-size: 1.1rem;
  border-radius: 50px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  text-align: center;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  width: 250px;
}

#username:focus {
  border-color: #6366f1;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

#username::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.hidden {
  opacity: 0;
  pointer-events: none;
}

header {
  display: flex;
  gap: 10px;
  align-items: center;
}


#maca-video {
  width: 80px; /* Smaller for mobile */
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #6366f1;
  flex-shrink: 0;
}

.bubble {
  background: #eef2ff;
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 1rem; /* Smaller font for mobile */
  font-weight: 500;
  line-height: 1.4;
}

.card h3 {
  margin-bottom: 20px;
  font-size: 1.5rem;
  line-height: 1.4;
}

.option {
  background: #f5f5f5;
  padding: 15px 20px;
  border-radius: 10px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: .2s;
  font-size: 1.2rem;
}

.option:hover {
  transform: scale(1.02);
}

.correct { background: #d1fae5; }
.wrong   { background: #fee2e2; }

button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: #6366f1;
  color: white;
  cursor: pointer;
  margin-top: 10px;
}

button:disabled {
  background: #ccc;
}

.relations {
  display: flex; /* Changed from grid to flex for better stacking */
  flex-direction: row;
  gap: 20px;
  margin-top: 15px;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  flex: 2; /* Take up more space in row mode */
}
#people.list {
  flex: 1; /* Take up less space in row mode */
}

.project-container {
  display: flex;
  flex-direction: column;
}


.list {
  background: white; /* Clean background */
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 15px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.2s, border-color 0.2s;
}

.list.project {
  background: #f8fafc;
  border-style: solid;
  border-color: #e2e8f0;
}

.list li {
  background: white;
  padding: 8px 12px;
  border-radius: 50px; /* Pill shape */
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  font-size: 0.95rem;
  font-weight: 500;
  color: #334155;
  cursor: grab;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.list li:active {
  cursor: grabbing;
  box-shadow: 0 5px 10px rgba(0,0,0,0.1);
  transform: scale(1.02);
}

.list li::before {
  content: '👤';
  font-size: 1.1em;
}

.project h4 {
  margin: 0 0 10px 0;
  font-size: 0.8rem; /* Slightly smaller */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  word-wrap: break-word; /* Allow long titles to wrap */
  overflow-wrap: break-word;
}

.project.correct { 
  background: #d1fae5; 
  border-color: #34d399;
}
.project.wrong { 
  background: #fee2e2; 
  border-color: #f87171;
}

.final {
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 800px) { /* Increased threshold and changed to flex stacking */
  .relations {
    flex-direction: column;
    gap: 15px;
  }
  
  .projects-grid {
    grid-template-columns: 1fr 1fr; /* Keep 2 columns if space allows, or 1 if too narrow */
  }

  /* For very narrow phones */
  @media (max-width: 450px) {
    .projects-grid {
       grid-template-columns: 1fr;
    }
  }
  
  .intro-content {
    padding: 20px;
    width: 85%;
  }
  
  #username {
    width: 100%;
    box-sizing: border-box;
  }
  
  .card h3 {
    font-size: 1.2rem;
  }
  
  .option {
    font-size: 1rem;
    padding: 12px 15px;
  }
  
  header {
    flex-direction: column;
    text-align: center;
  }
}

@media (min-width: 601px) {
  #maca-video {
    width: 120px;
    height: 120px;
  }
  
  .bubble {
    font-size: 1.25rem;
    padding: 15px 20px;
  }
}
