/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(to bottom right, #fde2e4, #fad2e1);
  overflow-x: hidden;
}

/* HOST Screen */
#rr-host-screen {
  max-width: 600px;
  margin: 3rem auto;
  padding: 2rem;
  border-radius: 20px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  position: relative;
  animation: fadeInUp 0.6s ease-out;
  border: 4px solid transparent;
  background-clip: padding-box;
}

/* Animated gradient border effect */
#rr-host-screen::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  z-index: -1;
  border-radius: 24px;
  background: linear-gradient(45deg, #ff80ab, #80d8ff, #a7ffeb, #ea80fc);
  background-size: 300% 300%;
  animation: gradientBorder 5s ease infinite;
}

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

#rr-host-screen h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #333;
}

#rr-host-screen p {
  font-size: 1.1rem;
  margin: 0.5rem 0 1rem;
  color: #555;
}

/* Gender Buttons */
#rr-gender-options {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.rr-gender-btn {
  display: inline-block;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 12px;
  background-color: #f0f0f0;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  border: 2px solid transparent;
  text-align: center;
  min-width: 100px;
}

.rr-gender-btn:hover,
.rr-gender-btn:active {
  transform: scale(1.05);
}

.rr-gender-btn.selected[data-gender="boy"] {
  background-color: #bbdefb;
  border-color: #2196f3;
  color: #0d47a1;
}

.rr-gender-btn.selected[data-gender="girl"] {
  background-color: #f8bbd0;
  border-color: #e91e63;
  color: #880e4f;
}

.rr-gender-btn.selected[data-gender="twins"] {
  background-color: #e1bee7;
  border-color: #9c27b0;
  color: #4a148c;
}

#rr-link-section {
  text-align: center;
  animation: fadeIn 0.5s ease;
}

#rr-generated-link {
  font-size: 1rem;
  padding: 0.6rem 1rem;
  width: 90%;
  max-width: 100%;
  border: 2px solid #ccc;
  border-radius: 8px;
  margin-bottom: 1rem;
  text-align: center;
}

#rr-copy-btn, #rr-open-btn {
  padding: 0.6rem 1.4rem;
  font-size: 1rem;
  margin: 0.3rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  font-weight: 600;
  background: #4caf50;
  color: white;
}

#rr-copy-btn:hover,
#rr-open-btn:hover {
  background-color: #43a047;
  transform: scale(1.05);
}

#rr-open-btn {
  background: #2196f3;
}

#rr-open-btn:hover {
  background-color: #1976d2;
}

/* Touch-friendly animation */
.rr-gender-btn:active,
#rr-copy-btn:active,
#rr-open-btn:active {
  transform: scale(0.96);
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Layout */
.rr-wrapper {
  width: 100%;
  height: auto;
  position: relative;
  padding: 1rem;
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.rr-screen {
  width: 100%;
  max-width: 600px;
  text-align: center;
  margin: 2rem auto;
  padding: 2rem;
  background: linear-gradient(to bottom right, #fff5f7, #ffe6eb); /* soft pink fade */
  border-radius: 20px;
  border: 3px solid #ffb3c6; /* lovely border */
  box-shadow:
    0 0 0 10px rgba(255, 179, 198, 0.1), /* outer glow border */
    0 8px 20px rgba(255, 143, 171, 0.15); /* elevation shadow */
  animation: fadeInScreen 0.6s ease-out;
  overflow: hidden;
  backdrop-filter: blur(2px); /* soft glass effect */
}

@keyframes fadeInScreen {
  0% {
    opacity: 0;
    transform: translate(0%, 0%) scale(0.8);
  }
  100% {
    opacity: 1;
    scale(1);
  }
}

/* Input Field */
.rr-screen input[type="text"] {
  padding: 0.8rem;
  font-size: 1.1rem;
  border-radius: 12px;
  border: 2px solid #ffb3c6;
  margin-bottom: 1.2rem;
  width: 80%;
  outline: none;
  transition: box-shadow 0.3s ease;
}

.rr-screen input[type="text"]:focus {
  box-shadow: 0 0 5px #ff8fab;
}

/* Buttons */
.rr-button {
  padding: 0.8rem 1.5rem;
  background: #ff85a2;
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1.1rem;
  margin: 0.4rem;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.rr-button:hover {
  transform: scale(1.07);
  background-color: #ff6b96;
}

/* Difficulty Buttons */
.rr-level-select {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.rr-difficulty-btn {
  background: linear-gradient(135deg, #fcb6c9, #ff7da1);
  border: 2px solid white;
  margin-bottom: 35px;
}

/* Game Info */
.rr-score-timer {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  padding: 0 1rem;
  color: #333;
}

/* Game Area */
.rr-game-area {
  position: relative;
  width: 100%;
  height: 60vh;
  border-radius: 20px;
  background: #fff0f5;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(255, 192, 203, 0.4);
}

/* Animation Effects */
.rr-animated {
  animation: popIn 0.8s ease forwards;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* End Screen */
#rr-end-screen {
  z-index: 10;
  padding: 2.5rem 1.5rem;
  border-radius: 25px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
  background: linear-gradient(135deg, #ffd6e0, #e0bbff, #d0f4de, #ffcad4);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
  color: #4b1c33;
  transition: all 0.3s ease-in-out;
}

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

#rr-congrats-message {
  font-size: 2rem !important;
  margin-bottom: 1rem;
  color: #ec4899;
  animation: popIn 1s ease;
}

.rr-gender-reveal-text {
  position: relative;
  font-size: 2.5rem;
  margin-top: 1.5rem;
  color: #ff4d6d;
  font-weight: bold;
  animation: sparkleReveal 1s ease-out 0.5s forwards, glitterPulse 2s infinite;
  opacity: 0;
  padding: 1rem 2rem;
  z-index: 1;
}

.rr-gender-reveal-text::before,
.rr-gender-reveal-text::after {
  content: "✨✨✨✨✨";
  position: absolute;
  width: 100%;
  text-align: center;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.2rem;
  color: gold;
  animation: glitterStars 2s infinite ease-in-out alternate;
  pointer-events: none;
  z-index: -1;
}

.rr-gender-reveal-text::before {
  top: -1.5rem;
}

.rr-gender-reveal-text::after {
  bottom: -1.5rem;
}

@keyframes glitterStars {
  0% {
    opacity: 0.4;
    transform: translateX(-50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) scale(1.2);
  }
  100% {
    opacity: 0.4;
    transform: translateX(-50%) scale(1);
  }
}

@keyframes sparkleReveal {
  0% { opacity: 0; transform: scale(0.5) rotate(-15deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* Sharing Buttons */
.rr-share-buttons {
	margin-top: 45px;
}

/* Your Score */
#rr-player-score {
  font-size: 1.5rem;
  font-weight: bold;
}

/* Scoreboard */
.rr-scoreboard {
  list-style: none;
  margin-top: 2rem;
  text-align: left;
  padding: 0 1rem;
}

.rr-scoreboard li {
  margin: 0.5rem 0;
  padding: 0.7rem 1rem;
  background: #ffe4ec;
  border-radius: 10px;
  font-weight: bold;
  animation: fadeInScore 0.6s ease;
}

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

/* Canvas Sparkle */
#rr-sparkle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Share Section */
.rr-share-section {
  margin-top: 1.5rem;
}

#rr-play-again-btn {
  margin-top: 2.8rem;
}

/* Scratch Card */
#rr-scratch-card-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(to bottom right, #ffe4ec, #fce1ff);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 2rem;
}

#rr-scratch-heading {
  font-size: 1.8rem;
  color: #c2185b;
  margin-bottom: 1.5rem;
  font-weight: bold;
}

#rr-scratch-canvas {
  width: 90%;
  max-width: 400px;
  height: 200px;
  background: repeating-linear-gradient(
    45deg,
    #ffc1e3,
    #ffc1e3 10px,
    #ffeaa7 10px,
    #ffeaa7 20px
  );
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  cursor: pointer;
  touch-action: none;
}

#rr-scratch-reveal-text {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: #5a5a5a;
}

/* Responsive Tweaks */
@media (orientation: landscape) {
  .rr-game-area {
    height: 50vh;
  }
}

@media (max-width: 480px) {
  .rr-button {
    font-size: 1rem;
    padding: 0.6rem 1.2rem;
	margin-top: 20px;
  }

  .rr-gender-reveal-text {
    font-size: 2rem;
  }

  .rr-screen input[type="text"] {
    width: 90%;
  }

  .rr-score-timer {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
  #rr-congrats-message {
  	font-size: 1.3rem !important;
  }
  .rr-level-select .rr-difficulty-btn {
    display: block;
    width: 60%;
    margin: 0.5rem auto;
  }
  .rr-wrapper {
	padding: 0;	
	}
  .rr-screen {
    padding: 1rem;
  }
}

@media (max-width: 600px) {
  #rr-host-screen {
    margin: 1.5rem 1rem;
    padding: 1.5rem;
  }

  .rr-gender-btn {
    width: 100%;
    font-size: 1rem;
  }

  #rr-generated-link {
    font-size: 0.95rem;
  }

  #rr-copy-btn,
  #rr-open-btn {
    width: 48%;
    font-size: 0.95rem;
  }
}