:root {
  --ink: #3d2a36;
  --muted: #7a5a68;
  --pink: #ff6b9d;
  --sky: #7ec8ff;
  --navy: #1a1430;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: "Jua", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 226, 122, 0.35), transparent 40%),
    radial-gradient(ellipse at 85% 10%, rgba(255, 138, 181, 0.4), transparent 42%),
    linear-gradient(180deg, #2a1f4a 0%, #7ec8ff 45%, #ffe4f0 100%);
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.home {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.title-wrap h1 {
  margin: 0;
  font-family: "Bagel Fat One", "Jua", cursive;
  font-weight: 400;
  font-size: clamp(28px, 5vw, 40px);
  color: var(--pink);
  text-shadow: 0 3px 0 #fff;
  line-height: 1;
}

.title-wrap p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.stat {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(61, 42, 54, 0.08);
}

.meter {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
  margin-bottom: 10px;
}

.meter > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffe27a, #ff6b9d, #6fd6b0);
  transition: width 0.2s ease;
}

.playfield {
  position: relative;
  background: #1a2030;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.45),
    0 18px 40px rgba(61, 42, 54, 0.18);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 720px);
  background: #223044;
}

.controls {
  display: none;
  position: absolute;
  right: 12px;
  bottom: 12px;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 4;
}

.controls .mid {
  display: flex;
  gap: 6px;
}

.ctrl {
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 14px;
  background: rgba(61, 42, 54, 0.45);
  color: #fff;
  font: inherit;
  font-size: 18px;
  backdrop-filter: blur(6px);
}

.ctrl:active {
  transform: scale(0.94);
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, 0.5), transparent 50%),
    linear-gradient(180deg, rgba(159, 216, 255, 0.94), rgba(255, 232, 240, 0.96));
}

.overlay.hidden {
  display: none;
}

.badge {
  display: inline-block;
  background: var(--pink);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  margin-bottom: 8px;
}

.badge.soft {
  background: #6fd6b0;
}

.hero-art {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 28px;
  border: 4px solid #ffe27a;
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.45), 0 12px 28px rgba(30, 20, 50, 0.35);
  margin-bottom: 8px;
}

.overlay h2 {
  margin: 0;
  font-family: "Bagel Fat One", "Jua", cursive;
  font-weight: 400;
  font-size: clamp(34px, 8vw, 52px);
  color: var(--pink);
  text-shadow: 0 3px 0 #fff;
}

.overlay p {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.45;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 34px;
  font: inherit;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(180deg, #ff8ab5, #ff5f97);
  box-shadow: 0 7px 0 #e03f74;
  cursor: pointer;
}

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

.overlay a {
  margin-top: 12px;
  color: var(--muted);
  text-decoration: none;
}

@media (hover: none), (max-width: 900px) {
  .controls {
    display: flex;
    right: 8px;
    bottom: 8px;
  }

  .ctrl {
    width: 58px;
    height: 58px;
    font-size: 20px;
    background: rgba(61, 42, 54, 0.62);
  }

  .topbar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .stats {
    justify-content: flex-start;
  }
}
