
@font-face {
  font-family: 'Butcherman';
  src: url('fonts/Butcherman.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Special Elite';
  src: url('fonts/SpecialElite.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Metal Mania';
  src: url('fonts/MetalMania.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: 'Special Elite', 'Metal Mania', sans-serif;
  color: #ffb347;
}
body {

      background:
        radial-gradient(ellipse at 20% 15%, rgba(120,40,160,.4) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 80%, rgba(200,80,0,.3) 0%, transparent 45%),
        linear-gradient(160deg, #0d0614 0%, #1a0a24 35%, #2a1030 65%, #120810 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: 'Butcherman', 'Metal Mania', cursive;
  font-size: clamp(1.1rem, 5.5vw, 1.85rem);
  line-height: 1.15;
  text-shadow: 0 0 10px rgba(255,106,0,.7), 0 3px 12px rgba(0,0,0,.8);
  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(20, 8, 28, 0.8);
  border: 2px solid rgba(255,140,0,.4);
  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,#ff6a00,#ffb347); color: #1a0a14;
  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(20, 8, 28, 0.8);
  border: 2px solid rgba(255,140,0,.4);
  border-radius: 20px;
}
.cell {
  position: relative;
  border-radius: 12px;
  background: rgba(255,140,0,.08);
}
.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: 'Butcherman', 'Metal Mania', cursive;
  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: 'Special Elite', 'Metal Mania', 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(20, 8, 28, 0.8);
  border: 2px solid rgba(255,140,0,.4);
  border-radius: 20px;
  padding: 18px 20px;
  text-align: center;
  max-width: 86%;
  color: #ffb347;
}
.overlay-card h2 { margin: 0 0 6px; font-family: 'Butcherman', 'Metal Mania', cursive; }
.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; }
}
