* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #dff3ec;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Trebuchet MS", "Segoe UI", ui-rounded, system-ui, sans-serif;
  color: #5b2a5e;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  outline: none;
}

.hidden {
  display: none !important;
}

/* ---- corner buttons (pause / mute) ---- */
#corner {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  display: flex;
  gap: 8px;
  z-index: 5;
}

.round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 3px 10px rgba(91, 42, 94, 0.18);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #5b2a5e;
  touch-action: manipulation;
}

.round svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.round .wave {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.round .off,
.round.muted .on {
  display: none;
}

.round.muted .off {
  display: block;
}

.round:active {
  transform: scale(0.92);
}

/* ---- overlays ---- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(91, 42, 94, 0.22);
  z-index: 10;
  animation: fade 0.25s ease-out;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.card {
  width: min(92vw, 420px);
  max-height: calc(100% - 8px);
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf8 0%, #fff1f6 100%);
  border: 3px solid #fff;
  border-radius: 28px;
  box-shadow: 0 14px 40px rgba(91, 42, 94, 0.28), inset 0 -6px 0 rgba(255, 143, 177, 0.18);
  padding: 22px 22px 20px;
  text-align: center;
  animation: pop 0.35s cubic-bezier(.2, 1.4, .4, 1);
}

.fruit-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2px;
  min-height: 52px;
  margin-bottom: 4px;
}

.fruit-row img {
  display: block;
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.logo {
  font-size: 46px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin: 2px 0 8px;
}

.logo .b {
  color: #3fb6a8;
  text-shadow: 0 3px 0 #1f7e74;
}

.logo .m {
  color: #ff5f86;
  text-shadow: 0 3px 0 #c22d58;
}

h2 {
  font-size: 34px;
  font-weight: 900;
  margin: 2px 0 12px;
  color: #ff5f86;
  text-shadow: 0 3px 0 #c22d58;
}

.tag {
  font-size: 17px;
  line-height: 1.35;
  margin-bottom: 16px;
}

.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 10px auto 0;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  color: #5b2a5e;
  background: #fff;
  box-shadow: 0 4px 0 #e3c6dc, 0 6px 14px rgba(91, 42, 94, 0.14);
  cursor: pointer;
  touch-action: manipulation;
}

.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #ff86a5 0%, #ff5f86 100%);
  box-shadow: 0 5px 0 #c22d58, 0 8px 18px rgba(194, 45, 88, 0.35);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #c22d58;
}

.best {
  margin-top: 14px;
  font-size: 17px;
}

.hint {
  margin-top: 6px;
  font-size: 15px;
  opacity: 0.75;
}

.badge {
  display: inline-block;
  padding: 4px 14px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: #ffd93d;
  color: #7a4a00;
  font-weight: 900;
  font-size: 16px;
  animation: pop 0.6s cubic-bezier(.2, 1.6, .4, 1) infinite alternate;
}

.final span,
.stats span {
  display: block;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.7;
}

.final b {
  display: block;
  font-size: 54px;
  line-height: 1.05;
  font-weight: 900;
}

.stats {
  display: flex;
  gap: 10px;
  margin: 10px 0 6px;
}

.stats > div {
  flex: 1;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  padding: 8px 6px;
}

.stats b {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  font-size: 22px;
  font-weight: 900;
}

.stats b i {
  font-style: normal;
  font-size: 17px;
}

.stats img {
  width: 30px;
  height: 30px;
}

/* compact cards for short screens (phones in landscape) */
@media (max-height: 520px) {
  .card {
    padding: 12px 18px 12px;
    border-radius: 22px;
  }
  .fruit-row { min-height: 36px; }
  .fruit-row img { width: 34px; height: 34px; }
  .logo { font-size: 36px; margin-bottom: 4px; }
  h2 { font-size: 28px; margin-bottom: 6px; }
  .tag { font-size: 15px; margin-bottom: 6px; }
  .btn { min-height: 46px; font-size: 20px; margin-top: 8px; }
  .best { margin-top: 8px; font-size: 15px; }
  .hint { font-size: 14px; margin-top: 2px; }
  .final b { font-size: 40px; }
  .stats { margin: 6px 0 2px; }
  .stats b { min-height: 28px; font-size: 19px; }
}

@media (min-width: 1500px) and (min-height: 950px) {
  .card { zoom: 1.3; }
}

@media (max-height: 360px) {
  .fruit-row { display: none; }
  .tag { display: none; }
}
