* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  background: #e59a3a;
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  overflow: hidden;
  color: #3a1f12;
  touch-action: none;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 80% at 50% 0%, #f6c56a 0%, transparent 55%),
    #e59a3a;
}

#stage {
  position: relative;
  width: min(100vw, 100dvh, 720px);
  aspect-ratio: 1;
  background: url("assets/bg.jpg") center / cover no-repeat;
  box-shadow: 0 18px 50px rgba(80, 30, 0, 0.35);
  overflow: hidden;
}

#hud {
  position: absolute;
  z-index: 4;
  left: 14%;
  right: 14%;
  top: 19.2%;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.stat {
  min-width: 38%;
  padding: 4px 12px 6px;
  border-radius: 14px;
  background: rgba(58, 32, 16, 0.55);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 220, 140, 0.25);
  text-align: center;
  color: #fff8e6;
  text-shadow: 0 2px 0 #2a1408;
}

.stat .label {
  display: block;
  font-size: clamp(10px, 2.2vw, 13px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.9;
}

.stat span:last-child {
  font-size: clamp(18px, 4.4vw, 28px);
  font-weight: 800;
  line-height: 1.1;
}

#board-wrap {
  position: absolute;
  left: 13.1%;
  top: 23.2%;
  width: 73.8%;
  height: 61.7%;
  z-index: 3;
}

#gpu, #fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: pointer;
}

#fx {
  pointer-events: none;
}

#hint {
  display: none;
}

#combo {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  font-size: clamp(22px, 6vw, 42px);
  font-weight: 900;
  color: #ffe566;
  -webkit-text-stroke: 5px #3a1a08;
  paint-order: stroke fill;
  text-shadow: 0 4px 0 #3a1a08;
  pointer-events: none;
  animation: comboPop 0.7s ease-out forwards;
}

@keyframes comboPop {
  0% { transform: translate(-50%, -40%) scale(0.4); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -70%) scale(1); opacity: 0; }
}

#fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px;
  background: rgba(40, 18, 6, 0.88);
  color: #fff6e4;
  text-align: center;
  font-size: 18px;
}

#fallback[hidden] {
  display: none !important;
}

#fallback p {
  margin: 0;
  max-width: 420px;
}

#logo {
  position: absolute;
  z-index: 4;
  left: 6%;
  right: 6%;
  top: 7.6%;
  margin: 0;
  text-align: center;
  font-size: clamp(34px, 9.4vw, 64px);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  pointer-events: none;
}
#logo .mango {
  color: #8fd32a;
  -webkit-text-stroke: 6px #1c3d08;
  paint-order: stroke fill;
  text-shadow: 3px 4px 0 #1c3d08;
}
#logo .mash {
  color: #f5d025;
  -webkit-text-stroke: 6px #3a1a08;
  paint-order: stroke fill;
  text-shadow: 3px 4px 0 #3a1a08;
}
#tagline {
  position: absolute;
  z-index: 4;
  left: 8%;
  right: 8%;
  top: 86.2%;
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: clamp(12px, 2.8vw, 18px);
  color: #fffdf6;
  -webkit-text-stroke: 4px #2a1408;
  paint-order: stroke fill;
  text-shadow: 0 2px 0 #2a1408;
  pointer-events: none;
  line-height: 1.25;
}
#hud {
  top: 18.6%;
}

#mute {
  position: absolute;
  z-index: 6;
  right: 3.5%;
  top: 3.2%;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font: 700 12px/1 "Trebuchet MS", sans-serif;
  color: #fff8e6;
  background: rgba(58, 32, 16, 0.7);
  box-shadow: 0 2px 0 #2a1408;
  cursor: pointer;
  pointer-events: auto;
  min-height: 36px;
}
#fps {
  position: absolute;
  z-index: 6;
  left: 3.5%;
  top: 3.2%;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,0.55);
  color: #9cff7a;
  font: 700 12px/1 ui-monospace, monospace;
  pointer-events: none;
}
#logo { top: 6.6%; }
#hud { top: 16.8%; }
#board-wrap { top: 22.4%; height: 62.2%; }
