
@font-face {
  font-family: 'Sigmar One';
  src: url('fonts/SigmarOne.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: 'Titan One';
  src: url('fonts/TitanOne.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', 'Titan One', sans-serif;
  color: #1a3d0a;
}
body {

      background:
        radial-gradient(circle at 20% 25%, rgba(255,255,255,.35) 0 18px, transparent 20px),
        radial-gradient(circle at 80% 70%, rgba(180,220,100,.4) 0 50px, transparent 52px),
        radial-gradient(ellipse at 50% 100%, rgba(60,100,20,.35) 0%, transparent 50%),
        linear-gradient(145deg, #b8e986 0%, #7cb342 45%, #558b2f 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: 'Sigmar One', 'Titan One', sans-serif;
  font-size: clamp(1.1rem, 5.5vw, 1.85rem);
  line-height: 1.15;
  text-shadow: 0 2px 0 #e8ffc8, 0 6px 16px rgba(40,100,20,.4);
  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(40, 80, 20, 0.4);
  border: 3px solid rgba(255,255,255,.45);
  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,#7cb342,#aed581); color: #1a3d0a;
  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(40, 80, 20, 0.4);
  border: 3px solid rgba(255,255,255,.45);
  border-radius: 20px;
}
.cell {
  position: relative;
  border-radius: 12px;
  background: rgba(255,255,255,.28);
}
.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: 'Sigmar One', 'Titan One', 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', 'Titan One', 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(40, 80, 20, 0.4);
  border: 3px solid rgba(255,255,255,.45);
  border-radius: 20px;
  padding: 18px 20px;
  text-align: center;
  max-width: 86%;
  color: #1a3d0a;
}
.overlay-card h2 { margin: 0 0 6px; font-family: 'Sigmar One', 'Titan One', 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; }
}
