/* Global resets and base styles */
body, html {
  margin: 0;
  padding: 0;
  font-family: 'Quicksand', sans-serif;
  background: linear-gradient(to bottom, #ffe0f5, #ffffff);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.tth-container {
  max-width: 600px;
  margin: auto;
  padding: 1rem;
  text-align: center;
}

/* HOST Screen */
.tth-host-screen {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  border: 3px solid #ff66aa;
  border-radius: 1rem;
  text-align: center;
  animation: popIn 0.8s ease;
}

.host-options label {
  display: inline-flex;
  align-items: center;
  font-size: 1.2rem;
  margin: 0.5rem 1rem;
  padding: 0.8rem 1.6rem;
  border: 3px solid #ff99cc;
  border-radius: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  background: #fff;
}

.host-options label input {
  display: none;
}

.host-options label.selected {
  background: #e60073;
  color: white;
  transform: scale(1.05);
}

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

.host-options label.boy.selected {
  background: #66ccff;
  border-color: #33aaff;
  color: white;
}

.host-options label.girl.selected {
  background: #ff66cc;
  border-color: #ff3399;
  color: white;
}

.host-options label.twins.selected {
  background: #99ff99;
  border-color: #33cc77;
  color: white;
}

.host-options label:hover,
.host-options label:active {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.host-link-box {
  margin-top: 1.5rem;
  text-align: center;
}

#host-generated-link {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  border-radius: 1rem;
  border: 2px solid #ccc;
  background: #f9f9f9;
}

.host-actions button {
  margin: 1rem 0.5rem;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 2rem;
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(to right, #ff99cc, #ff66aa);
  color: white;
  animation: glowBtn 1.4s infinite alternate;
}
.host-actions button:hover {
  transform: scale(1.05);
}

@keyframes glowBtn {
  from { box-shadow: 0 0 8px rgba(255,102,170, 0.6); }
  to { box-shadow: 0 0 16px rgba(255,102,170, 1); }
}

/* Start Screen */
.tth-start-screen h2 {
  font-size: 2.2rem;
  color: #e60073;
  animation: pulseTitle 1s ease-in-out infinite alternate;
}

.tth-start-screen p {
  color: #5a004f;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* Level Buttons */
.tth-levels button {
  padding: 0.9rem 1.7rem;
  margin: 0.5rem;
  border: 2px solid #ff66aa;
  border-radius: 2rem;
  font-size: 1rem;
  font-weight: bold;
  background: linear-gradient(to right, #ff99cc, #ff66aa);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(255, 102, 170, 0.3);
  transition: all 0.3s ease;
}

.tth-levels button:hover,
.tth-levels button:focus {
  background: #ff3399;
  transform: scale(1.05);
}

.tth-levels button:active {
  transform: scale(0.95);
  background: #e60073;
}

/* Selected button (optional) */
.tth-levels button.selected {
  background: #e60073 !important;
  border-color: #a3005a;
}

/* Theme Selection Section */
.tth-themes {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #fff0f5;
  border: 2px dashed #ff99cc;
  border-radius: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  animation: fadeIn 0.5s ease-in-out;
}

.tth-themes label {
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  color: #a3005a;
  background: #ffe0f0;
  padding: 0.6rem 1.2rem;
  border-radius: 2rem;
  border: 2px solid #ff99cc;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(255, 105, 180, 0.2);
  user-select: none;
  margin-top: 20px;
}

.tth-themes input[type="radio"] {
  display: none !important;
}

.tth-themes input[type="radio"]:checked + label,
.tth-themes label:has(input[type="radio"]:checked) {
  background: #e60073;
  color: white;
  border-color: #cc005f;
  box-shadow: 0 0 10px #e60073;
}

.tth-themes label:hover {
  background: #ffd6ea;
  transform: scale(1.05);
}

/* Continue Button for Theme Selection */
.tth-themes button#tth-theme-continue {
  display: block;
  margin-top: 1rem;
  width: 40%;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(to right, #ff99cc, #ff66aa);
  color: white;
  font-weight: bold;
  font-size: 1rem;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(255, 105, 180, 0.3);
  transition: background 0.3s ease, transform 0.2s ease;
  margin-bottom: 20px;
}

.tth-themes button#tth-theme-continue:hover {
  background: #ff3399;
  transform: scale(1.05);
}

.tth-themes button#tth-theme-continue:active {
  background: #cc005f;
  transform: scale(0.95);
}

/* 🎀 VALENTINE THEME */
body.theme-valentine {
  background: radial-gradient(#ffb6c1, #ff69b4);
}
body.theme-valentine .tth-start-screen h2,
body.theme-valentine .tth-end-screen h2 {
  color: #e60073;
}
body.theme-valentine .tth-levels button {
  background: linear-gradient(to right, #ff99cc, #ff66aa);
  border-color: #ff66aa;
}
body.theme-valentine .heart {
  background: radial-gradient(circle, #fff0f5, #ffccdd);
  box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

/* ❄️ WINTER THEME */
body.theme-winter {
  background: linear-gradient(to bottom, #e0f7fa, #b2ebf2);
}
body.theme-winter .tth-start-screen h2,
body.theme-winter .tth-end-screen h2 {
  color: #007acc;
}
body.theme-winter .tth-levels button {
  background: linear-gradient(to right, #80dfff, #33ccff);
  border-color: #33ccff;
}
body.theme-winter .heart {
  background: radial-gradient(circle, #e0f7ff, #b2ebf2);
  box-shadow: 0 0 10px rgba(0, 153, 255, 0.4);
}

/* 🏖️ BEACH THEME */
body.theme-beach {
  background: linear-gradient(to bottom, #87cefa, #ffe4b5);
}
body.theme-beach .tth-start-screen h2,
body.theme-beach .tth-end-screen h2 {
  color: #ff8c00;
}
body.theme-beach .tth-levels button {
  background: linear-gradient(to right, #ffdb58, #ffa500);
  border-color: #ffa500;
}
body.theme-beach .heart {
  background: radial-gradient(circle, #fff7e0, #ffd580);
  box-shadow: 0 0 10px rgba(255, 165, 0, 0.4);
}

.tth-theme-icons {
  text-align: center;
  font-size: 2rem;
  margin: 0.8rem 0;
}

body.theme-valentine .tth-theme-icons::before {
  content: "💘💌💝";
}
body.theme-winter .tth-theme-icons::before {
  content: "❄️☃️🎿";
}
body.theme-beach .tth-theme-icons::before {
  content: "🌞🌴🏄‍♀️";
}

/* Hide Grammarly browser extension elements if injected */
grammarly-extension,
grammarly-card,
grammarly-editor-plugin {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

div[class^="grammarly-"] {
  display: none !important;
}

/* Game Screen */
.tth-game-screen {
  position: relative;
  min-height: 100vh;
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.tth-top-bar {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  font-weight: bold;
  font-size: 1.1rem;
  background: #fff0f5;
  border-bottom: 2px solid #ffcce5;
  color: #333;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.tth-timer-bar-container {
  width: 100%;
  height: 12px;
  background-color: #f0f0f0;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tth-timer-bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.2s ease, background 0.3s ease;
  background: linear-gradient(90deg, #ff66b2, #66ccff);
  border-radius: 6px;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 8px #ff3b3b, 0 0 16px #ff3b3b;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 20px #ff3b3b, 0 0 40px #ff3b3b;
    transform: scale(1.08);
  }
}

.tth-timer-bar-fill.pulse {
  animation: pulse-glow 1.5s infinite;
}

/* Heart Drop Zone */
.tth-heart-area {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 1rem;
  min-height: 300px;
  position: relative;
  overflow: hidden;
  flex: 1;
}

.golden-heart {
  animation: floatHeart 4s linear forwards;
  font-size: 2rem;
  color: gold;
  filter: drop-shadow(0 0 8px gold);
}

/* Heart Description */
.tth-level-desc {
  margin-top: 0.5rem;
  color: #a3005a;
  font-weight: bold;
  font-size: 1rem;
  animation: fadeIn 0.5s ease-in-out;
}

/* Hearts */
.falling-heart {
  position: absolute;
  top: -60px;
  animation: fallHeart 4s linear forwards, glowPulse 1.5s ease-in-out infinite;
  z-index: 5;
}

.heart {
  width: 60px;
  height: 60px;
  margin: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: radial-gradient(circle, #fff0f5, #ffccdd);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
  transition: transform 0.2s ease, opacity 0.4s ease;
  user-select: none;
}

.heart:active {
  transform: scale(0.85);
}

.heart.clicked {
  opacity: 0;
  transform: scale(0);
}

/* Animations */
@keyframes fallHeart {
  0% { top: -60px; opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes glowPulse {
  0% { box-shadow: 0 0 10px rgba(255, 105, 180, 0.5); }
  50% { box-shadow: 0 0 20px rgba(255, 105, 180, 0.9); }
  100% { box-shadow: 0 0 10px rgba(255, 105, 180, 0.5); }
}

@keyframes pulseTitle {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* End Screen */
.tth-end-screen {
  min-height: 100vh;
  padding: 3rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to top, #ffe6f0, #ffffff);
  position: relative;
}

.tth-end-screen h2 {
  font-size: 2.2rem;
  color: #e60073;
  animation: popIn 1s ease forwards;
}

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

.tth-summary {
  margin-top: 1.2rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: #5a004f;
}

/* Celebration canvas */
canvas#tth-celebration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Social Sharing */
.tth-social-share {
  margin-top: 1rem;
}
.tth-social-share a {
  display: inline-block;
  background: #ffe0f5;
  padding: 0.6rem 1.2rem;
  margin: 0.3rem;
  border-radius: 1.5rem;
  text-decoration: none;
  color: #333;
  font-weight: bold;
  transition: all 0.3s ease;
  border: 1px solid #ffcce5;
  box-shadow: 0 2px 6px rgba(255, 105, 180, 0.2);
}
.tth-social-share a:hover {
  background: #ffccdd;
  transform: scale(1.05);
}

button {
  font-family: inherit;
}

.tth-end-screen button {
  margin-top: 1.2rem;
  padding: 0.8rem 2rem;
  background: #ff66aa;
  color: white;
  font-weight: bold;
  font-size: 1rem;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(255, 102, 170, 0.3);
  transition: background 0.3s ease, transform 0.2s ease;
}

.tth-end-screen button:hover {
  background: #e60073;
  transform: scale(1.05);
}

.tth-end-screen button:active {
  transform: scale(0.95);
  background: #cc005f;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* 🎉 Enhanced Gender Reveal Text */
#tth-final-text {
  font-size: 3.5rem !important;
  font-weight: 900 !important;
  text-align: center;
  margin-bottom: 1.2rem;
  background: linear-gradient(90deg, #ff66cc, #ffccff, #66ccff);
  background-size: 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerText 3s ease-in-out infinite, popBounce 1.2s ease forwards;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* ✨ Shimmer animation */
@keyframes shimmerText {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 💥 Bounce-in effect */
@keyframes popBounce {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}

.tth-floating-hearts {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  top: 0;
  left: 0;
  z-index: 9999 !important;
  overflow: hidden;
}

.tth-floating-hearts span {
  position: absolute;
  bottom: -40px;
  left: 0;
  animation: riseHeart 4s linear forwards;
  font-size: 1.5rem;
  opacity: 0.8;
  z-index: 10000;
}

@keyframes riseHeart {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-100vh) scale(1.5);
    opacity: 0;
  }
}

@media (max-width: 600px) {
  .tth-themes {
    flex-direction: column;
    align-items: center;
  }

  .tth-themes label,
  .tth-themes button#tth-theme-continue {
    width: 70% !important;
    text-align: center;
    margin: 0.5rem 0;
  }
}