body {
  margin: 0;
  font-family: 'Comic Sans MS', cursive, sans-serif;
  background: #ffeef2;
  overflow-x: hidden;
}

/* HOST Screen */
.host-wrapper {
  padding: 2rem;
  border-radius: 20px;
  background: #ffffff;
  animation: pulse-border 2s infinite alternate;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  max-width: 700px;
  margin: 2rem auto;
  text-align: center;
  font-family: 'Segoe UI', sans-serif;
  transition: all 0.3s ease;
}

.host-wrapper h1 {
  font-size: 2.2rem;
  background: linear-gradient(to right, #ff69b4, #2196f3, #4caf50);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 3s infinite linear;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.host-wrapper ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 2rem;
  font-size: 1.1rem;
}

.gender-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.gender-options label {
  padding: 1rem 2rem;
  font-size: 1.3rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #f0f0f0;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  user-select: none;
}

.gender-options input[type="radio"] {
  display: none;
}

.gender-radio:hover,
.gender-radio:active {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.boy-option {
  background-color: #e3f2fd;
  color: #0d47a1;
}

.girl-option {
  background-color: #fce4ec;
  color: #880e4f;
}

.twins-option {
  background-color: #e8f5e9;
  color: #1b5e20;
}

.selected-boy .boy-option {
  border-color: #2196f3;
  box-shadow: 0 0 10px #64b5f6;
}

.selected-girl .girl-option {
  border-color: #e91e63;
  box-shadow: 0 0 10px #f06292;
}

.selected-twins .twins-option {
  border-color: #4caf50;
  box-shadow: 0 0 10px #81c784;
}

#link-section {
  margin-top: 2rem;
  font-size: 1.1rem;
  color: #444;
  animation: fadeIn 0.5s ease;
}

.token-link-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.token-link-box input {
  width: 60%;
  min-width: 240px;
  padding: 0.6rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.token-link-box button {
  padding: 0.6rem 1rem;
  font-weight: bold;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #2196f3;
  color: white;
  transition: background 0.3s ease;
}

.token-link-box button:hover,
.token-link-box button:focus {
  background: #1976d2;
}

.token-link-box button:active {
  transform: scale(0.98);
}

@keyframes pulse-border {
  0%   { box-shadow: 0 0 10px rgba(255, 0, 150, 0.2); }
  100% { box-shadow: 0 0 25px rgba(0, 150, 255, 0.4); }
}

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

.game-container {
  text-align: center;
  padding: 2rem;
  max-width: 100%;
  box-sizing: border-box;
}

.game-title {
  font-size: 2rem;
  margin-bottom: 1rem;
  animation: bounce 1s infinite;
}

.puzzle-instructions {
  background: #fff3cd;
  color: #856404;
  padding: 10px 15px;
  margin: 0 auto 25px auto;
  border-radius: 10px;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  max-width: 600px;
}

#progress-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 1rem;
  text-align: left;
}
#progress-bar {
  height: 8px;
  background: linear-gradient(90deg, #ff69b4, #ff1493);
  width: 0%;
  transition: width 0.4s ease;
  border-radius: 4px;
}
#progress-text {
  font-size: 0.9rem;
  color: #555;
  margin-top: 4px;
  display: block;
  font-weight: bolder;
  text-align: center;
}

.puzzle-preview {
  text-align: center;
  margin-bottom: 1.5rem;
}

.puzzle-preview-img {
  max-width: 200px;
  border: 2px solid #fcb;
  border-radius: 8px;
  box-shadow: 0 0 6px rgba(0,0,0,0.1);
  margin: auto !important;
}

#puzzle-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  gap: 4px;
  border: 3px solid #fcb;
  background: #fff;
}

.puzzle-piece {
  width: 100%;
  height: 100%;
  background-size: 300% 300%; /* 3x3 layout */
  background-repeat: no-repeat;
  border-radius: 8px;
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
  cursor: grab;
}

.puzzle-piece.dragging {
  opacity: 0.5;
  transform: scale(1.1);
  cursor: grabbing;
}

#puzzle-message {
  text-align: center;
  margin-top: 1rem;
}

.you-did-it-message {
  font-size: 2.5rem;
  font-weight: 900;
  color: #ff1493;
  text-shadow: 0 0 8px #ffb6c1;
  margin: 1rem 0;
  animation: bounce 1s infinite;
}

/* End screen container */
.end-screen {
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 100vh; /* ensure it still fills the screen */
  background: #fff0f6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* allow content to flow down */
  padding: 2rem 1rem;
  box-sizing: border-box;
  overflow: visible; /* allow height to grow */
  z-index: 999;
}

/* Layered effects behind content */
.effects-layer {
  position: absolute;
  top:0; left:0; width:100%; height:100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
#sparkle-canvas,
.confetti {
  position: absolute;
  top:0; left:0; width:100%; height:100%;
}

/* Bring text and buttons above effects */
.end-screen > *:not(.effects-layer) {
  position: relative;
  z-index: 2;
  margin: 0.5rem 0;
}

/* Attempt count style */
.attempts-count {
  font-size: 1.3rem;
  color: #333;
  background: #fff;
  padding: 8px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

/* Balloon and confetti dots */
.balloons {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.balloon {
  position: absolute;
  width: 60px;
  height: 80px;
  background: radial-gradient(ellipse at center, #d4af37 0%, #b8860b 100%);
  border-radius: 50% 50% 45% 45%;
  opacity: 0.85;
  animation: floatUp 10s linear infinite;
}

.balloon::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 30px;
  background: #444;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.5;
}

.balloon.black {
  background: radial-gradient(ellipse at center, #444 0%, #111 100%);
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) scale(1);
    opacity: 0.7;
  }
  50% {
    transform: translateY(50vh) scale(1.05);
    opacity: 0.9;
  }
  100% {
    transform: translateY(-100px) scale(1);
    opacity: 0;
  }
}

.confetti .dot {
  position:absolute; width:8px; height:8px;
  border-radius:50%; opacity:0.8;
  animation: conf-fall 3s linear infinite;
}
@keyframes conf-fall { 
  0% {transform: translateY(-10%) rotate(0deg);}
  100% {transform: translateY(110%) rotate(360deg);}
}

.end-screen button {
  background: linear-gradient(135deg, #ff69b4, #ff1493);
  border: none;
  padding: 12px 24px;
  color: white;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 30px;
  margin: 0.75rem auto;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  width: 220px;
  max-width: 90%;
  display: inline-block;
  touch-action: manipulation;
}

.end-screen button:hover,
.end-screen button:focus {
  background: linear-gradient(135deg, #ff3e96, #ff1493);
  transform: scale(1.05);
}

.end-screen button:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.end-screen.hidden {
  display: none;
}

.hidden {
	display: none !important;
}

body.end-visible #puzzle-board {
  opacity: 0;
  pointer-events: none;
}

body.end-visible .puzzle-preview {
  display: none;
}

.reveal-text {
  font-size: 3.5rem !important;
  font-weight: 900 !important;
  margin: 1rem 0 !important;
  text-shadow: 0 0 10px #ffb6c1, 0 0 20px #ff69b4 !important;
  animation: sparkleGlow 1.5s infinite ease-in-out !important;
  transition: transform 0.4s ease !important;
}

.reveal-boy    { color: #2196f3; text-shadow: 0 0 10px #90caf9; }
.reveal-girl   { color: #e91e63; text-shadow: 0 0 10px #f8bbd0; }
.reveal-twins  { color: #4caf50; text-shadow: 0 0 10px #a5d6a7; }

.reveal-text:hover {
  transform: scale(1.05);
}

@keyframes sparkleGlow {
  0%, 100% {
    text-shadow: 0 0 10px #ffb6c1, 0 0 20px #ff69b4;
  }
  50% {
    text-shadow: 0 0 15px #ff69b4, 0 0 30px #ff1493;
  }
}

button {
  background: #ff69b4;
  border: none;
  padding: 10px 20px;
  margin: 0.5rem;
  color: white;
  font-size: 1rem;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.3s;
}

button:hover {
  background: #ff3e96;
}

.social-share {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.social-share button {
  color: #fff;
  padding: 8px 12px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: none;
  cursor: pointer;
  width: auto;
}

.social-share button.whatsapp { background: #25d366; }
.social-share button.facebook { background: #1877f2; }
.social-share button.x        { background: #1da1f2; }

.social-share button:hover,
.social-share button:focus {
  background: #00bfff;
  transform: scale(1.05);
  filter: brightness(1.1);
}

.social-share button:active {
  transform: scale(0.95);
}

.spread-love-text {
  font-size: 1.5rem;
  font-weight: bold;
  color: #e75480;
  text-align: center;
  margin: 20px 0 10px 0;
  animation: pulse-heart 2s infinite;
}

@keyframes pulse-heart {
  0% { transform: scale(1); text-shadow: 0 0 5px #ffc0cb; }
  50% { transform: scale(1.1); text-shadow: 0 0 15px #ff69b4; }
  100% { transform: scale(1); text-shadow: 0 0 5px #ffc0cb; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes sparkle {
  0% { text-shadow: 0 0 5px #ffb6c1; }
  100% { text-shadow: 0 0 15px #ff69b4; }
}

.puzzle-summary {
  display: inline-block;
  width: 200px;
  margin: 15px;
  text-align: center;
  background: #fff9f9;
  border: 3px dashed #ffc0cb;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  padding: 10px;
  transition: transform 0.2s ease;
}

.puzzle-summary:hover {
  transform: scale(1.05);
}

.summary-thumbnail {
  width: 174px;
  height: 174px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #ccc;
}

@media (max-width: 500px) {
  .game-container {
    padding: 1rem;
  }

  .puzzle-preview-img {
    max-width: 120px;
  }

  .reveal-text {
    font-size: 2.3rem !important;
  }

  button {
    font-size: 0.9rem;
    padding: 8px 16px;
  }
	
  .attempts-count {
	  font-size: 1.1rem;
	  padding: 8px 16px;
	}

	.end-screen button {
	  font-size: 1rem;
	  width: 100%;
	  padding: 10px;
	}
}

@media (max-width: 480px) {
  .gender-options {
    flex-direction: column;
    align-items: center;
	width: 100%;
  }
	
  .gender-options label {
    width: 65%;
    text-align: center;
  }

  .token-link-box input {
    width: 100%;
  }

  .token-link-box {
    flex-direction: column;
    align-items: center;
  }
	
  .token-link-box input {
    width: 100%;
    margin: 0 auto;
  }

  .token-link-box button {
    width: 70%;
    margin: 0.3rem auto;
    font-size: 1.1rem;
  }
}