
:root {
  --pink: #ff6fb1;
  --yellow: #ffd75e;
  --blue: #62d2ff;
  --green: #7ee081;
  --purple: #a78bfa;
  --text: #263238;
  --card: rgba(255, 255, 255, 0.9);
  --slot: rgba(255, 255, 255, 0.72);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  font-family: "Nunito", "Trebuchet MS", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 18%, rgba(255, 215, 94, 0.95) 0 8%, transparent 9%),
    radial-gradient(circle at 88% 16%, rgba(167, 139, 250, 0.78) 0 10%, transparent 11%),
    radial-gradient(circle at 18% 88%, rgba(126, 224, 129, 0.8) 0 9%, transparent 10%),
    linear-gradient(135deg, #fff7d8 0%, #e8f8ff 45%, #f7e9ff 100%);
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.home-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  border: 3px solid rgba(255,255,255,0.96);
  color: #7957c8;
  font-family: "Baloo 2", cursive;
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 7px 24px rgba(50,90,80,0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  touch-action: manipulation;
  cursor: pointer;
}

.home-btn:hover,
.home-btn:focus-visible {
  transform: translateY(-2px) scale(1.03);
  background: rgba(255,255,255,0.96);
  outline: none;
}

.home-btn:active {
  transform: scale(0.94);
}

.home-icon {
  font-size: 1.25rem;
  line-height: 1;
}


.game-shell {
  width: min(980px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 78px 16px 24px;
  display: grid;
  gap: 18px;
  align-content: center;
}

.intro-card,
.board-card {
  background: var(--card);
  border: 6px solid #fff;
  border-radius: 32px;
  box-shadow: 0 22px 60px rgba(70, 90, 120, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.intro-card {
  text-align: center;
  padding: 24px 22px;
}

.mini-badge {
  display: inline-flex;
  padding: 7px 14px;
  border-radius: 999px;
  background: #fff7cc;
  border: 3px dashed #ffb703;
  color: #8a5a00;
  font-family: "Baloo 2", cursive;
  font-weight: 900;
  margin-bottom: 10px;
}

h1 {
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.5rem, 9vw, 5rem);
  line-height: 0.95;
  color: #ff4fa3;
  text-shadow: 3px 3px 0 #ffe45e, 6px 6px 0 rgba(98, 210, 255, 0.72);
  margin-bottom: 10px;
}

.instructions {
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 800;
  color: #4b6070;
  margin-bottom: 16px;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.stat {
  min-width: 100px;
  padding: 8px 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  border: 3px solid rgba(255,255,255,0.95);
}

.stat span {
  display: block;
  font-family: "Baloo 2", cursive;
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #8066a0;
  font-weight: 900;
}

.stat strong {
  display: block;
  font-family: "Baloo 2", cursive;
  font-size: 1.7rem;
  line-height: 1;
  color: #4a3060;
}

.board-card {
  padding: clamp(18px, 4vw, 30px);
}

.prompt {
  text-align: center;
  font-family: "Baloo 2", cursive;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: #4a3060;
  font-weight: 900;
  margin-bottom: 16px;
}

.drop-row,
.tile-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 2vw, 16px);
}

.drop-row {
  min-height: 112px;
  padding: 16px;
  border-radius: 26px;
  background: rgba(98, 210, 255, 0.22);
  border: 4px dashed rgba(98, 160, 200, 0.45);
  margin-bottom: 28px;
}

.tile-bank {
  min-height: 124px;
  padding: 18px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.48);
  border: 4px solid rgba(255,255,255,0.7);
  margin-top: 6px;
}

.slot,
.tile {
  width: clamp(62px, 14vw, 86px);
  height: clamp(62px, 14vw, 86px);
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-family: "Baloo 2", cursive;
  font-size: clamp(2rem, 8vw, 3.4rem);
  font-weight: 900;
}

.slot {
  position: relative;
  overflow: hidden;
  color: rgba(74, 48, 96, 0.32);
  background: var(--slot);
  border: 4px dashed rgba(74, 48, 96, 0.22);
}

.slot::before {
  content: attr(data-letter);
}

.slot.hover {
  transform: scale(1.05);
  border-color: #ff9f43;
  background: #fff7cc;
}

.slot.filled {
  border-style: solid;
  border-color: rgba(126, 224, 129, 0.95);
  background: rgba(126, 224, 129, 0.22);
}

.slot.filled::before {
  content: '';
}

.tile {
  border: 5px solid #fff;
  color: #fff;
  cursor: grab;
  box-shadow: 0 10px 20px rgba(70, 90, 120, 0.18);
  touch-action: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tile:active { cursor: grabbing; }

.tile.dragging {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  transform: scale(1.08) rotate(4deg);
  box-shadow: 0 18px 34px rgba(70, 90, 120, 0.28);
}

.tile.correct {
  cursor: default;
  animation: pop 0.22s ease-out;
}

.slot .tile {
  width: 100%;
  height: 100%;
  border-width: 4px;
  border-radius: 18px;
  box-shadow: none;
  transform: none;
}

@keyframes pop {
  0% { transform: scale(0.85); }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.feedback {
  min-height: 32px;
  margin: 18px 0 12px;
  text-align: center;
  color: #4b6070;
  font-weight: 900;
  font-size: 1.05rem;
}

.feedback.good { color: #22863a; }
.feedback.try { color: #c07000; }
.feedback.win { color: #c0306a; font-size: 1.2rem; }

.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.game-btn {
  border: none;
  border-radius: 999px;
  padding: 13px 28px;
  font-family: "Baloo 2", cursive;
  font-size: 1.05rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #ff6fb1, #a78bfa);
  box-shadow: 0 8px 24px rgba(160, 90, 190, 0.26);
  cursor: pointer;
  touch-action: manipulation;
}

.game-btn.secondary { background: linear-gradient(135deg, #62d2ff, #7ee081); }
.game-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.game-btn:not(:disabled):active { transform: scale(0.95); }

@media (max-width: 700px) {
  .game-shell {
    align-content: start;
    padding-top: 78px;
    padding-bottom: 18px;
  }

  .intro-card {
    padding: 18px 16px;
  }

  .board-card {
    padding: 16px 14px 18px;
  }

  .drop-row {
    min-height: 96px;
    padding: 12px;
    margin-bottom: 24px;
  }

  .tile-bank {
    min-height: 106px;
    padding: 14px 12px;
  }

  .slot,
  .tile {
    width: clamp(54px, 15vw, 72px);
    height: clamp(54px, 15vw, 72px);
    border-radius: 18px;
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }

  .feedback {
    margin-top: 16px;
    font-size: 1rem;
  }
}

@media (max-width: 580px) {
  .home-text { display: none; }
  .home-btn { width: 52px; height: 52px; justify-content: center; padding: 0; border-radius: 50%; }
  .game-shell { padding-top: 70px; gap: 14px; }
  .prompt { font-size: 1rem; line-height: 1.3; }
  .drop-row { margin-bottom: 22px; }
  .actions { gap: 10px; }
  .game-btn { width: min(180px, 100%); }
}


#fireworksCanvas {
  position: fixed;
  inset: 0;
  z-index: 900;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
