:root {
  --ink: #000;
  --pink: #ff2e88;
  --pink-2: #ff4d9c;
  --yel: #ffe600;
  --blue: #2d6bff;
  --red: #ff3b30;
  --mint: #2ef2b0;
  --paper: #fffdf2;
  --display: "Arial Black", "Segoe UI Black", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--pink);
  background-image:
    radial-gradient(rgba(0,0,0,.16) 22%, transparent 25%),
    repeating-linear-gradient(135deg, var(--pink) 0 24px, var(--pink-2) 24px 48px);
  background-size: 14px 14px, auto;
  color: var(--ink);
  font-family: var(--text);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* header */
.top {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  padding: 10px 14px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo { width: 34px; height: 34px; flex: none; filter: drop-shadow(3px 3px 0 #000); }
.brand {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -.03em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 3px 3px 0 #000;
  -webkit-text-stroke: 1.5px #000;
}
.tag {
  margin-left: auto;
  font-family: var(--display);
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--yel);
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  padding: 3px 10px;
  border-radius: 999px;
  transform: rotate(3deg);
}

/* stage */
main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 18px 0 12px;
  min-height: 0;
}
#stage {
  position: relative;
  width: 100%;
  max-width: 540px;
  height: calc(100vh - 112px);
  height: calc(100dvh - 112px);
  min-height: 420px;
  max-height: 860px;
  border: 4px solid #000;
  border-radius: 20px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  box-shadow: 8px 8px 0 #000;
  background: var(--blue);
}
#game { display: block; touch-action: none; cursor: crosshair; }

.hud-btn {
  position: absolute;
  top: 10px;
  width: 44px; height: 44px;
  border-radius: 14px;
  border: 3px solid #000;
  background: var(--yel);
  color: #000;
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 4px 4px 0 #000;
  z-index: 3;
  transition: transform .08s, box-shadow .08s;
}
.hud-btn:active { transform: translate(3px, 3px) scale(1.06, .9); box-shadow: 1px 1px 0 #000; }
.hud-btn svg { width: 22px; height: 22px; }
#btn-sound { right: 14px; }
#btn-pause { right: 68px; }
#btn-sound .off { display: none; }
#btn-sound.is-muted { background: #fff; }
#btn-sound.is-muted .on { display: none; }
#btn-sound.is-muted .off { display: block; }
.hud-btn[hidden] { display: none; }

/* overlays and panels */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 20px 14px;
  background: rgba(0,0,0,.28);
  z-index: 2;
}
.overlay[hidden] { display: none; }
.panel {
  width: 100%;
  max-width: 380px;
  max-height: 100%;
  overflow: auto;
  background: var(--paper);
  border: 4px solid #000;
  border-radius: 20px;
  padding: 20px 18px 22px;
  text-align: center;
  box-shadow: 8px 8px 0 #000;
  animation: slam .32s cubic-bezier(.2,1.7,.4,1);
}
@keyframes slam { from { transform: scale(.7) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }

.poster {
  background-color: var(--yel);
  background-image: radial-gradient(var(--pink) 28%, transparent 31%);
  background-size: 12px 12px;
  background-position: 0 0;
  position: relative;
}
.poster::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, var(--yel) 55%, rgba(255,230,0,0) 85%);
  border-radius: 16px;
  pointer-events: none;
}
.poster > * { position: relative; }

.kicker {
  display: inline-block;
  font-family: var(--display);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: #000;
  color: var(--yel);
  padding: 4px 10px;
  border-radius: 6px;
  transform: rotate(-2deg);
  margin-bottom: 8px;
}
.title {
  margin: 0 0 12px;
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  line-height: .9;
  letter-spacing: -.045em;
}
.title .t1 {
  display: block;
  font-size: clamp(42px, 13vw, 62px);
  color: #fff;
  -webkit-text-stroke: 3px #000;
  paint-order: stroke fill;
  text-shadow: 5px 5px 0 #000;
}
.title .t2 {
  display: inline-block;
  margin-top: 6px;
  font-size: clamp(34px, 10.5vw, 50px);
  color: var(--yel);
  background: var(--pink);
  border: 4px solid #000;
  box-shadow: 5px 5px 0 #000;
  padding: 2px 16px 6px;
  transform: rotate(-5deg) skewX(-10deg);
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 #000;
}
.panel h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 34px;
  line-height: .95;
  letter-spacing: -.04em;
  text-transform: uppercase;
}
.lead { margin: 0 0 12px; font-size: 15px; line-height: 1.38; font-weight: 600; }
.rules { list-style: none; margin: 0 0 12px; padding: 0; text-align: left; font-size: 14px; line-height: 1.3; display: grid; gap: 7px; }
.rules li {
  display: flex; gap: 10px; align-items: center;
  background: #fff;
  border: 3px solid #000;
  border-radius: 12px;
  box-shadow: 3px 3px 0 #000;
  padding: 5px 10px 5px 6px;
  font-weight: 700;
}
.rules li:nth-child(odd) { transform: rotate(-.6deg); }
.rules li:nth-child(even) { transform: rotate(.6deg); }
.rules b {
  flex: none;
  min-width: 40px;
  text-align: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 16px;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 2px 4px;
  background: var(--mint);
}
.rules .gold { background: var(--yel); }
.rules .bad { background: var(--red); color: #fff; }
.controls { margin: 0 0 16px; font-size: 12.5px; line-height: 1.4; font-weight: 600; }
.btn {
  appearance: none;
  display: inline-block;
  border: 4px solid #000;
  background: var(--pink);
  color: #fff;
  font-family: var(--display);
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -.01em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 38px 14px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 6px 6px 0 #000;
  -webkit-text-stroke: 1.5px #000;
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 #000;
  transition: transform .09s, box-shadow .09s;
}
.btn:hover { transform: rotate(-2deg) scale(1.03); }
.btn:active { transform: translate(5px, 5px) scale(1.08, .86); box-shadow: 1px 1px 0 #000; }
.btn:focus-visible, .hud-btn:focus-visible { outline: 4px solid var(--blue); outline-offset: 4px; }
.best { margin: 14px 0 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.score-big {
  font-family: var(--display);
  font-size: 92px;
  font-weight: 900;
  line-height: 1;
  margin: 4px 0 8px;
  color: var(--yel);
  -webkit-text-stroke: 4px #000;
  paint-order: stroke fill;
  text-shadow: 6px 6px 0 #000;
  animation: pulse .6s .25s cubic-bezier(.2,1.8,.4,1) both;
}
@keyframes pulse { from { transform: scale(.4) rotate(-10deg); } to { transform: none; } }
.new-best {
  display: inline-block;
  margin: 2px 0 6px;
  background: var(--mint);
  border: 3px solid #000;
  box-shadow: 3px 3px 0 #000;
  border-radius: 999px;
  padding: 4px 14px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 14px;
  text-transform: uppercase;
  transform: rotate(-4deg);
}
.new-best[hidden] { display: none; }

footer {
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  padding: 14px 16px 14px;
}

/* 404 */
.nf { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px 20px 16px 16px; }
.nf .panel { max-width: 400px; }
.nf svg { width: 150px; height: auto; margin: 4px auto 6px; display: block; }
.nf-code {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 96px;
  line-height: .9;
  letter-spacing: -.06em;
  color: #fff;
  -webkit-text-stroke: 4px #000;
  paint-order: stroke fill;
  text-shadow: 6px 6px 0 #000;
  transform: rotate(-4deg);
}

@media (max-width: 380px) {
  .panel { padding: 16px 13px 18px; }
  .rules { font-size: 13px; }
  .lead { font-size: 14px; }
  .tag { display: none; }
  .btn { font-size: 21px; padding: 11px 30px 13px; }
}
@media (max-height: 640px) {
  .controls { display: none; }
  .lead { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .panel, .score-big { animation: none; }
  .btn, .hud-btn { transition: none; }
}
