:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #24112f;
  color: #fffafc;
}

* {
  box-sizing: border-box;
}

body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: #78d2ff;
}

.game-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

.stage-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #78d2ff;
}

canvas {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100vw, calc(100vh * 16 / 9));
  height: max(100vh, calc(100vw * 9 / 16));
  transform: translate(-50%, -50%);
  image-rendering: auto;
}

.hud {
  position: absolute;
  inset: 14px 14px auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.hearts,
.arena {
  min-height: 44px;
  border-radius: 8px;
  background: rgba(45, 17, 55, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.hearts {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
}

.heart {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #ff4d7d;
  font-size: 25px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.42);
}

.heart.empty {
  color: rgba(255, 255, 255, 0.34);
  text-shadow: none;
}

.arena {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 7px 12px;
  text-align: right;
  font-weight: 800;
}

.arena span:last-child {
  font-size: 12px;
  color: #ffd7e8;
  font-weight: 700;
}

.message {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(420px, calc(100% - 36px));
  transform: translate(-50%, -50%);
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  color: #341447;
  background: rgba(255, 250, 252, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.26);
  text-align: center;
}

.message.hidden {
  display: none;
}

.message strong {
  font-size: clamp(26px, 6vw, 44px);
  line-height: 0.95;
}

.message span {
  font-size: 14px;
  line-height: 1.35;
}

.message button {
  justify-self: center;
  min-width: 132px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #ef386d;
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 5px 0 #a81948;
}

.message button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #a81948;
}

.task-banner {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%) scale(1);
  min-width: min(640px, calc(100% - 32px));
  padding: 16px 24px 18px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 76, 132, 0.94), rgba(196, 36, 94, 0.94));
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 14px 40px rgba(86, 20, 65, 0.36),
    inset 0 2px 0 rgba(255, 255, 255, 0.42);
  font-size: clamp(34px, 8vw, 76px);
  font-weight: 1000;
  line-height: 0.92;
  text-align: center;
  text-shadow: 0 4px 0 rgba(112, 20, 58, 0.4);
  pointer-events: none;
  opacity: 1;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.task-banner.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
}

.touch-controls {
  display: none;
  position: fixed;
  inset: auto 0 18px;
  align-items: end;
  justify-content: space-between;
  padding: 0;
  z-index: 5;
  pointer-events: none;
}

.stick,
.jump-tile {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.stick {
  position: relative;
  width: 118px;
  height: 118px;
  margin-left: max(18px, env(safe-area-inset-left));
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.52), transparent 0 15%, transparent 16%),
    radial-gradient(circle at 50% 56%, rgba(255, 118, 168, 0.82), rgba(185, 45, 103, 0.86) 62%, rgba(115, 36, 93, 0.94));
  box-shadow:
    0 8px 0 rgba(89, 28, 82, 0.72),
    inset 0 6px 0 rgba(255, 255, 255, 0.35),
    inset 0 -10px 0 rgba(84, 28, 84, 0.3);
}

.stick::before,
.stick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(255, 243, 193, 0.72);
  transform: translate(-50%, -50%);
}

.stick::before {
  width: 72px;
  height: 10px;
  border-radius: 999px;
}

.stick::after {
  width: 10px;
  height: 72px;
  border-radius: 999px;
}

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, #fff7bf 0 11%, transparent 12%),
    radial-gradient(circle at 50% 58%, #ffcf53, #ff8b38 66%, #b94335);
  box-shadow:
    0 5px 0 rgba(128, 48, 46, 0.72),
    inset 0 5px 0 rgba(255, 255, 255, 0.46);
  transform: translate(-50%, -50%);
}

.jump-tile {
  position: relative;
  width: 92px;
  height: 92px;
  margin-right: max(22px, env(safe-area-inset-right));
  border: 2px solid rgba(255, 255, 255, 0.48);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.56), transparent 0 14%, transparent 15%),
    radial-gradient(circle at 50% 58%, #65d8ff, #2f92e8 64%, #42519b);
  box-shadow:
    0 8px 0 rgba(37, 54, 128, 0.74),
    inset 0 6px 0 rgba(255, 255, 255, 0.36),
    inset 0 -10px 0 rgba(26, 56, 132, 0.32);
}

.jump-tile::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: 28px;
  height: 28px;
  border-left: 8px solid #fff6be;
  border-top: 8px solid #fff6be;
  transform: translate(-50%, -50%) rotate(45deg);
  filter: drop-shadow(0 4px 0 rgba(35, 61, 126, 0.36));
}

.rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 152, 195, 0.35), transparent 0 34%, transparent 35%),
    rgba(33, 11, 48, 0.82);
  backdrop-filter: blur(8px);
}

.rotate-overlay.hidden {
  display: none;
}

.rotate-card {
  width: min(340px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-radius: 8px;
  color: #341447;
  text-align: center;
  background: rgba(255, 250, 252, 0.94);
  border: 2px solid rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.3);
}

.rotate-card strong {
  font-size: 26px;
  line-height: 1.05;
}

.rotate-card span:last-child {
  font-size: 15px;
  line-height: 1.35;
}

.phone-icon {
  position: relative;
  width: 72px;
  height: 104px;
  border: 7px solid #ef386d;
  border-radius: 16px;
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, 0.72), transparent 0 14%, transparent 15%),
    linear-gradient(180deg, #72deff, #4788ef);
  box-shadow:
    0 6px 0 #9a1e56,
    inset 0 6px 0 rgba(255, 255, 255, 0.3);
  transform: rotate(12deg);
}

.phone-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 14px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  transform: translateX(-50%);
}

.phone-icon::after {
  content: "";
  position: absolute;
  right: -36px;
  top: 22px;
  width: 34px;
  height: 34px;
  border-top: 8px solid #ffcf53;
  border-right: 8px solid #ffcf53;
  border-radius: 0 20px 0 0;
  transform: rotate(28deg);
  filter: drop-shadow(0 3px 0 rgba(116, 55, 72, 0.34));
}

@media (max-width: 760px), (pointer: coarse) {
  body {
    overflow: hidden;
  }

  .hud {
    inset: 8px 8px auto;
  }

  .heart {
    width: 22px;
    height: 22px;
    font-size: 21px;
  }

  .arena {
    min-height: 38px;
    padding: 6px 9px;
    font-size: 13px;
  }

  .touch-controls {
    display: flex;
  }
}
