
@font-face {
  font-family: 'Luckiest Guy';
  src: url('fonts/LuckiestGuy.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/Nunito.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('fonts/Fredoka.woff2') format('woff2');
  font-display: swap;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  font-family: 'Nunito', 'Fredoka', sans-serif;
  color: #7a1f4a;
}
body {

      background:
        radial-gradient(circle at 18% 78%, rgba(255,255,255,.55) 0 40px, transparent 42px),
        radial-gradient(circle at 82% 18%, rgba(255,182,193,.55) 0 28px, transparent 30px),
        radial-gradient(ellipse at 30% 20%, #ffe4ec 0%, transparent 55%),
        linear-gradient(145deg, #ffb6c8 0%, #ffd6e0 45%, #fff0f5 100%);

}
#app {
  position: relative;
  min-height: 100%;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: clamp(8px, 2.5vw, 18px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2vw, 14px);
}

header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
h1 {
  margin: 0;
  font-family: 'Luckiest Guy', 'Fredoka', sans-serif;
  font-size: clamp(1.1rem, 5.5vw, 1.85rem);
  line-height: 1.15;
  text-shadow: 0 2px 0 #fff, 0 4px 12px rgba(176,58,106,.35);
  letter-spacing: normal;
}
.tag {
  width: 100%;
  margin: 0;
  opacity: .85;
  font-size: clamp(.75rem, 2.8vw, .95rem);
}
.scores {
  display: flex; gap: 8px;
}
.scorebox {
  background: rgba(176, 58, 106, 0.28);
  border: 3px solid rgba(255,255,255,.55);
  border-radius: 20px;
  padding: 6px 12px;
  text-align: center;
  min-width: 72px;
}
.scorebox .label { font-size: .65rem; text-transform: uppercase; opacity: .75; letter-spacing: .06em; }
.scorebox .val { font-size: 1.15rem; font-weight: 700; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
button {
  appearance: none; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700;
  background: linear-gradient(135deg,#ff6b9d,#ff8fab); color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: 0 6px 16px rgba(0,0,0,.2);
}
button:disabled { opacity: .45; cursor: default; }
button:active { transform: translateY(1px); }
#board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: min(72vh, 100vw);
  touch-action: none;
  user-select: none;
}
#board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: clamp(6px, 1.8vw, 10px);
  width: 100%; height: 100%;
  padding: clamp(6px, 1.8vw, 10px);
  background: rgba(176, 58, 106, 0.28);
  border: 3px solid rgba(255,255,255,.55);
  border-radius: 20px;
}
.cell {
  position: relative;
  border-radius: 12px;
  background: rgba(255,255,255,.42);
}
.tile {
  position: absolute; inset: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 140ms ease, background 140ms ease;
  overflow: hidden;
}
.tile.empty { background: transparent !important; box-shadow: none !important; border: none !important; }
.tile.pop { animation: pop 140ms ease; }
@keyframes pop {
  0% { transform: scale(.6); }
  80% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.tile-emoji {
  width: 58%; height: 58%; object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.3));
  pointer-events: none;
}
.tile-main {
  font-weight: 800;
  font-size: clamp(1rem, 6vw, 1.8rem);
  font-family: 'Luckiest Guy', 'Fredoka', sans-serif;
  line-height: 1;


}
.tile-badge {
  position: absolute; top: 4px; right: 6px;
  font-size: clamp(.55rem, 2.2vw, .75rem);
  font-weight: 700; opacity: .9;
  font-family: 'Nunito', 'Fredoka', sans-serif;
}
#overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55);
  border-radius: 20px;
  z-index: 10;
  backdrop-filter: blur(2px);
}
#overlay[hidden] { display: none !important; }
.overlay-card {
  background: rgba(176, 58, 106, 0.28);
  border: 3px solid rgba(255,255,255,.55);
  border-radius: 20px;
  padding: 18px 20px;
  text-align: center;
  max-width: 86%;
  color: #7a1f4a;
}
.overlay-card h2 { margin: 0 0 6px; font-family: 'Luckiest Guy', 'Fredoka', sans-serif; }
.overlay-card p { margin: 0 0 12px; }
.overlay-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
footer {
  margin-top: auto;
  text-align: center;
  font-size: .7rem;
  opacity: .55;
}
footer span { opacity: .9; }
@media (min-width: 700px) {
  #app { padding-top: 20px; }
}
