:root {
  color: #39425e;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", "Arial Rounded MT Bold", system-ui, sans-serif;
  background: #d8f2ff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.92), transparent 20%),
    radial-gradient(circle at 84% 12%, rgba(255, 221, 122, 0.52), transparent 18%),
    linear-gradient(180deg, #a9dcff 0%, #e5f7ff 100%);
  overflow: hidden;
}

button {
  font: inherit;
}

.game-shell {
  width: min(100vw, 920px);
  padding: 16px;
}

.game {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 420px;
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border: 8px solid #ffffff;
  border-radius: 8px;
  background: url("assets/stage_bg_1.png") center / cover no-repeat;
  box-shadow: 0 18px 50px rgba(69, 132, 190, 0.24);
  user-select: none;
  touch-action: manipulation;
}

.game::after {
  content: none;
}

.game[data-stage="2"] {
  background-image: url("assets/stage_bg_2.png");
}

.game[data-stage="2"]::after {
  content: none;
}

.game[data-stage="3"] {
  background-image: url("assets/stage_bg_3.png");
}

.game[data-stage="3"]::after {
  content: none;
}

.sky,
.world,
.screen {
  position: absolute;
  inset: 0;
}

.sky {
  display: none;
}

.cloud {
  position: absolute;
  width: 118px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  bottom: 8px;
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  left: 18px;
  width: 44px;
  height: 44px;
}

.cloud::after {
  right: 22px;
  width: 54px;
  height: 54px;
}

.cloud-a {
  top: 15%;
  left: 8%;
}

.cloud-b {
  top: 22%;
  right: 18%;
  transform: scale(0.78);
}

.cloud-c {
  top: 9%;
  right: 4%;
  transform: scale(0.55);
}

.hud {
  position: absolute;
  z-index: 5;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.mini-title,
.stage-pill,
.score {
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #315fa7;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(99, 118, 161, 0.12);
}

.mini-title {
  padding: 7px 12px;
  font-size: clamp(12px, 2vw, 16px);
}

.stage-pill {
  display: grid;
  place-items: center;
  width: clamp(330px, 44vw, 470px);
  min-height: clamp(86px, 11vw, 118px);
  padding: 35px 84px 18px 76px;
  border-radius: 0;
  background: url("assets/stage_sign_wide.png") center / contain no-repeat;
  color: #315fa7;
  font-size: clamp(18px, 2.2vw, 25px);
  text-shadow:
    0 2px 0 #ffffff,
    2px 0 0 #ffffff,
    -2px 0 0 #ffffff,
    0 -2px 0 #ffffff;
  white-space: nowrap;
  box-shadow: none;
  overflow: visible;
  text-overflow: ellipsis;
  transform: translateY(-8px);
}

.score {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 124px;
  padding: 7px 10px 7px 9px;
  border: 4px solid #ffffff;
  background: linear-gradient(180deg, rgba(255, 247, 207, 0.98) 0%, rgba(255, 226, 129, 0.95) 100%);
  color: #315fa7;
  font-size: clamp(13px, 2vw, 17px);
  box-shadow: 0 5px 0 rgba(49, 95, 167, 0.15), 0 8px 18px rgba(99, 118, 161, 0.12);
}

.score::before,
.score::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #ff8faf;
  box-shadow: 0 0 0 3px #ffffff;
}

.score::before {
  width: 8px;
  height: 8px;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
}

.score::after {
  width: 7px;
  height: 7px;
  right: 8px;
  top: -5px;
  background: #8fc8ff;
}

.score-icon {
  width: 22px;
  height: 18px;
  border-radius: 20% 76% 18% 82%;
  background:
    radial-gradient(circle at 64% 42%, #e96f6b 0 13%, transparent 14%),
    radial-gradient(circle at 42% 64%, #78bf6a 0 10%, transparent 11%),
    linear-gradient(135deg, #ffe991 0%, #ffbd3f 80%);
  clip-path: polygon(8% 8%, 100% 28%, 28% 100%);
  filter: drop-shadow(0 2px 0 rgba(129, 83, 44, 0.14));
}

.score-label {
  font-size: 0.82em;
}

.score-number {
  min-width: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #ffffff;
  color: #f45d86;
  font-size: 1.08em;
  text-align: center;
  box-shadow: inset 0 -2px 0 rgba(49, 95, 167, 0.08);
}

.guard-status {
  position: absolute;
  z-index: 6;
  top: 84px;
  right: 22px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 7px 12px;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7cf 0%, #ffe9f0 100%);
  color: #315fa7;
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 5px 0 rgba(49, 95, 167, 0.13);
  pointer-events: none;
}

.guard-apple {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 46% 54% 52% 48% / 44% 46% 54% 56%;
  background: linear-gradient(145deg, #ff7a8a 0%, #dd4357 100%);
  box-shadow: inset -3px -3px 0 rgba(150, 35, 53, 0.15);
}

.guard-apple::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 9px;
  width: 4px;
  height: 8px;
  border-radius: 999px;
  background: #7c5b3b;
  transform: rotate(18deg);
}

.guard-apple::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 12px;
  width: 10px;
  height: 6px;
  border-radius: 70% 20% 70% 20%;
  background: #70bf78;
  transform: rotate(-18deg);
}

.start-tip {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 50%;
  width: min(90%, 560px);
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.84);
}

.start-tip img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(78vh, 360px);
  object-fit: contain;
  filter: drop-shadow(0 12px 0 rgba(49, 95, 167, 0.1));
}

.start-tip.show {
  animation: startTip 2.35s ease-out both;
}

.bonus-banner {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 38%;
  width: min(82%, 560px);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.78);
}

.bonus-banner.show {
  animation: bonusBanner 2s ease-out both;
}

.bonus-banner img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 0 rgba(49, 95, 167, 0.12));
}

.bonus-status {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: auto;
  bottom: clamp(10px, 1.6vw, 20px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 12px;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7cf 0%, #ffe281 100%);
  color: #f45d86;
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 5px 0 rgba(49, 95, 167, 0.13);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px) scale(0.92);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bonus-status::before,
.bonus-status::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #8fc8ff;
  box-shadow: 0 0 0 2px #ffffff;
}

.bonus-status::after {
  background: #ff8faf;
}

.bonus-status.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.rare-pizza-notice {
  position: absolute;
  z-index: 7;
  left: 18px;
  top: 92px;
  margin: 0;
  color: #f45d86;
  font-size: clamp(14px, 2.4vw, 20px);
  font-weight: 900;
  line-height: 1;
  text-shadow:
    0 2px 0 #ffffff,
    2px 0 0 #ffffff,
    -2px 0 0 #ffffff,
    0 -2px 0 #ffffff,
    0 5px 0 rgba(49, 95, 167, 0.12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.95);
}

.rare-pizza-notice.show {
  animation: rarePizzaNotice 1.7s ease-out both;
}

.stage-banner {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 30%;
  width: min(88%, 610px);
  margin: 0;
  padding: 14px 22px;
  border: 5px solid #ffffff;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7cf 0%, #ffe281 100%);
  color: #315fa7;
  font-size: clamp(20px, 4.4vw, 36px);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 8px 0 rgba(49, 95, 167, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -18px) scale(0.88);
}

.stage-banner.has-image {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.stage-banner.compact {
  left: auto;
  right: 18px;
  top: 94px;
  width: auto;
  max-width: min(58vw, 300px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f45d86;
  font-size: clamp(13px, 2vw, 18px);
  line-height: 1.25;
  text-align: right;
  text-shadow:
    0 2px 0 #ffffff,
    2px 0 0 #ffffff,
    -2px 0 0 #ffffff,
    0 -2px 0 #ffffff,
    0 4px 0 rgba(49, 95, 167, 0.12);
  box-shadow: none;
  transform: translateY(-8px) scale(0.96);
}

.stage-banner-image {
  display: block;
  width: 100%;
  max-height: min(42vh, 250px);
  object-fit: contain;
  filter: drop-shadow(0 10px 0 rgba(49, 95, 167, 0.1));
}

.stage-banner-text {
  display: block;
}

.stage-banner.has-image .stage-banner-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.stage-banner.show {
  animation: stageBanner 1.8s ease-out both;
}

.stage-banner.compact.show {
  animation: compactNotice 1.35s ease-out both;
}

.supporter {
  position: absolute;
  z-index: 6;
  top: 18%;
  right: 3%;
  display: grid;
  justify-items: end;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transform: translate(28%, 12%) scale(0.85);
}

.supporter.show {
  animation: supporterCheer 3.8s ease-in-out both;
}

.supporter img {
  width: clamp(86px, 16vw, 138px);
  height: auto;
  filter: drop-shadow(0 8px 0 rgba(49, 95, 167, 0.12));
}

.supporter-speech {
  position: relative;
  max-width: min(58vw, 260px);
  margin: 0;
  padding: 10px 14px;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: #fff7cf;
  color: #315fa7;
  font-size: clamp(12px, 2vw, 17px);
  font-weight: 900;
  line-height: 1.25;
  box-shadow: 0 6px 0 rgba(49, 95, 167, 0.12);
}

.supporter-speech::after {
  content: "";
  position: absolute;
  right: 34px;
  bottom: -13px;
  width: 18px;
  height: 18px;
  border-right: 4px solid #ffffff;
  border-bottom: 4px solid #ffffff;
  background: #fff7cf;
  transform: rotate(45deg);
}

.screen {
  z-index: 10;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 24px;
  background: rgba(215, 242, 255, 0.58);
  backdrop-filter: blur(4px);
  text-align: center;
}

.screen.hidden {
  display: none;
}

h1,
h2 {
  margin: 0;
  color: #315fa7;
  line-height: 1.05;
}

h1 {
  font-size: clamp(36px, 8vw, 76px);
}

.title-logo {
  display: block;
  width: min(90vw, 700px);
  max-height: min(62vh, 360px);
  object-fit: contain;
  filter: drop-shadow(0 10px 0 rgba(49, 95, 167, 0.1));
}

.story-modal {
  position: absolute;
  z-index: 11;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(210, 239, 255, 0.58);
  backdrop-filter: blur(3px);
}

.story-modal.hidden {
  display: none;
}

.story-card {
  position: relative;
  width: min(90vw, 620px);
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: clamp(14px, 2.5vw, 22px);
  border: 7px solid #ffffff;
  border-radius: 34px;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 143, 175, 0.22) 0 3%, transparent 3.2%),
    radial-gradient(circle at 82% 24%, rgba(143, 200, 255, 0.28) 0 3%, transparent 3.2%),
    radial-gradient(circle at 28% 74%, rgba(255, 226, 129, 0.2) 0 2.4%, transparent 2.6%),
    radial-gradient(circle at 72% 74%, rgba(157, 223, 138, 0.18) 0 2.4%, transparent 2.6%),
    linear-gradient(180deg, rgba(255, 251, 226, 0.98), rgba(232, 247, 255, 0.98));
  box-shadow: 0 10px 0 rgba(49, 95, 167, 0.15), 0 22px 42px rgba(49, 95, 167, 0.16);
}

.story-stage-image {
  width: min(86%, 430px);
  max-height: min(26vh, 170px);
  object-fit: contain;
  filter: drop-shadow(0 8px 0 rgba(49, 95, 167, 0.12));
}

.story-text {
  width: min(96%, 520px);
  margin: 0;
  color: #315fa7;
  font-size: clamp(13px, 2.1vw, 18px);
  font-weight: 900;
  line-height: 1.42;
  text-align: center;
  white-space: pre-line;
  text-shadow: 0 2px 0 #ffffff;
}

.story-ok {
  min-width: 122px;
  min-height: 42px;
  padding: 9px 20px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h2 {
  font-size: clamp(30px, 6vw, 56px);
}

.screen p {
  margin: 0;
  color: #6d759e;
  font-size: clamp(18px, 4vw, 28px);
  font-weight: 900;
}

.game-over-screen {
  padding: 16px;
}

.final-panel {
  position: relative;
  width: min(88vw, 520px);
  min-height: min(68vh, 400px);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  padding: clamp(20px, 4.2vw, 34px);
  border: 7px solid #ffffff;
  border-radius: 34px;
  background:
    radial-gradient(circle at 18% 28%, rgba(255, 143, 175, 0.22) 0 2%, transparent 2.2%),
    radial-gradient(circle at 82% 32%, rgba(143, 200, 255, 0.28) 0 2.3%, transparent 2.5%),
    radial-gradient(circle at 76% 78%, rgba(255, 196, 107, 0.26) 0 2%, transparent 2.2%),
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.94) 0 27%, transparent 28%),
    repeating-conic-gradient(from 0deg at 50% 42%, rgba(255, 226, 129, 0.28) 0deg 12deg, rgba(255, 247, 207, 0.6) 12deg 24deg),
    linear-gradient(180deg, #fff9dd 0%, #fff2bc 100%);
  box-shadow: 0 10px 0 rgba(49, 95, 167, 0.16), 0 22px 40px rgba(49, 95, 167, 0.14);
  overflow: hidden;
}

.final-title {
  position: relative;
  z-index: 2;
  margin: 0;
  width: min(88%, 430px);
}

.final-title img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 0 rgba(49, 95, 167, 0.14));
}

.final-title-clear,
.clear-party {
  display: none !important;
}

.clear-party {
  position: relative;
  z-index: 2;
  width: min(90%, 430px);
  margin: 0;
  overflow: visible;
  border: 5px solid #ffffff;
  border-radius: 24px;
  background: #dff4ff;
  box-shadow: 0 7px 0 rgba(49, 95, 167, 0.14);
}

.clear-party img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.game-over-screen.clear-screen .final-panel {
  width: min(88vw, 580px);
  max-height: calc(100% - 16px);
  min-height: 0;
  gap: 6px;
  padding: clamp(8px, 1.4vw, 14px);
  align-content: center;
}

.game-over-screen.clear-screen .final-panel::before,
.game-over-screen.clear-screen .final-panel::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 18%, #ffe281 0 5px, transparent 6px),
    radial-gradient(circle at 22% 76%, #8fc8ff 0 4px, transparent 5px),
    radial-gradient(circle at 36% 14%, #ff8faf 0 3px, transparent 4px),
    radial-gradient(circle at 68% 18%, #9ddf8a 0 4px, transparent 5px),
    radial-gradient(circle at 84% 72%, #d7a2ff 0 4px, transparent 5px),
    radial-gradient(circle at 91% 26%, #ffe281 0 3px, transparent 4px),
    radial-gradient(circle at 15% 48%, rgba(255, 255, 255, 0.95) 0 3px, transparent 4px),
    radial-gradient(circle at 76% 46%, rgba(255, 255, 255, 0.95) 0 3px, transparent 4px);
  opacity: 0.74;
  transform: scale(1);
}

.game-over-screen.clear-screen .final-panel::before {
  animation: clearSparkle 2.8s ease-in-out infinite;
}

.game-over-screen.clear-screen .final-panel::after {
  background:
    radial-gradient(circle at 18% 28%, #ffffff 0 3px, transparent 4px),
    radial-gradient(circle at 28% 62%, #ffe281 0 4px, transparent 5px),
    radial-gradient(circle at 44% 82%, #ff8faf 0 3px, transparent 4px),
    radial-gradient(circle at 58% 12%, #8fc8ff 0 4px, transparent 5px),
    radial-gradient(circle at 72% 78%, #9ddf8a 0 4px, transparent 5px),
    radial-gradient(circle at 88% 42%, #ffffff 0 3px, transparent 4px);
  opacity: 0.55;
  animation: clearSparkle 3.4s ease-in-out 0.55s infinite;
}

.game-over-screen.clear-screen .final-confetti-a,
.game-over-screen.clear-screen .final-confetti-b,
.game-over-screen.clear-screen .final-confetti-c,
.game-over-screen.clear-screen .final-confetti-d,
.game-over-screen.clear-screen .final-confetti-e {
  display: none;
}

.game-over-screen.clear-screen .final-star-a,
.game-over-screen.clear-screen .final-star-b,
.game-over-screen.clear-screen .final-star-c,
.game-over-screen.clear-screen .final-dot-a,
.game-over-screen.clear-screen .final-dot-b {
  animation: finalTwinkle 2.2s ease-in-out infinite;
}

.game-over-screen.clear-screen .final-star-b,
.game-over-screen.clear-screen .final-dot-b {
  animation-delay: 0.55s;
}

.game-over-screen.clear-screen .final-star-c {
  animation-delay: 1.1s;
}

.game-over-screen.clear-screen .final-title {
  width: min(42%, 240px);
}

.game-over-screen.clear-screen .final-title-default {
  display: none;
}

.game-over-screen.clear-screen .final-title-clear,
.game-over-screen.clear-screen .clear-party {
  display: block !important;
}

.game-over-screen.clear-screen .final-score {
  min-height: auto;
  width: min(52%, 190px);
  padding: 4px 10px;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px;
}

.game-over-screen.clear-screen .final-score-label {
  padding: 3px 12px;
  font-size: clamp(12px, 1.8vw, 15px);
}

.game-over-screen.clear-screen .final-score-number {
  min-width: 48px;
  padding: 0 6px;
  font-size: clamp(24px, 4vw, 34px);
}

.game-over-screen.clear-screen .clear-party {
  width: min(72%, 340px);
  border-width: 4px;
  border-radius: 18px;
  box-shadow: 0 5px 0 rgba(49, 95, 167, 0.14);
}

.game-over-screen.clear-screen .final-restart,
.game-over-screen.clear-screen .award-button,
.game-over-screen.clear-screen .share-button {
  min-height: 42px;
  min-width: 168px;
  padding: 9px 18px;
  font-size: 14px;
}

.game-over-screen.award-screen .final-title,
.game-over-screen.award-screen .clear-party,
.game-over-screen.award-screen .final-score {
  display: none !important;
}

.game-over-screen.award-screen .award-button {
  display: none;
}

.game-over-screen.award-screen .final-panel {
  width: min(94vw, 760px);
  gap: 12px;
  padding: clamp(10px, 1.8vw, 16px);
}

.game-over-screen.award-screen .final-actions {
  gap: 10px;
}

.game-over-screen.award-screen .final-restart,
.game-over-screen.award-screen .share-button {
  min-height: 42px;
  min-width: 168px;
  padding: 9px 18px;
  font-size: 14px;
}

.award-card {
  position: relative;
  z-index: 3;
  width: min(100%, 720px);
  margin: 0;
  border: 6px solid #ffffff;
  border-radius: 24px;
  overflow: hidden;
  background: #dff4ff;
  box-shadow: 0 8px 0 rgba(49, 95, 167, 0.15), 0 20px 38px rgba(49, 95, 167, 0.14);
}

.award-card img {
  display: block;
  width: 100%;
  height: auto;
}

.award-score {
  position: absolute;
  left: 50%;
  bottom: clamp(18px, 5.4vw, 48px);
  min-width: min(70%, 420px);
  padding: 10px 22px;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: rgba(255, 247, 207, 0.96);
  color: #315fa7;
  font-size: clamp(18px, 3.4vw, 34px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 0 #ffffff;
  box-shadow: 0 6px 0 rgba(49, 95, 167, 0.14);
  transform: translateX(-50%);
}

.final-score {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(76%, 300px);
  min-height: 122px;
  margin: 4px 0 2px;
  padding: 14px 16px 12px;
  border: 6px solid #b9dcff;
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(185, 220, 255, 0.45) 0 2px, transparent 2px 14px),
    #ffffff;
  box-shadow: inset 0 -6px 0 rgba(49, 95, 167, 0.08), 0 7px 0 rgba(49, 95, 167, 0.12);
}

.final-score-label {
  padding: 6px 22px;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: #7898d1;
  color: #ffffff;
  font-size: clamp(18px, 3.2vw, 24px);
  line-height: 1;
  box-shadow: 0 4px 0 rgba(49, 95, 167, 0.22);
}

.final-score-number {
  display: block;
  min-width: 112px;
  padding: 2px 20px 4px;
  border-radius: 999px;
  background: transparent;
  color: #f45d86;
  font-size: clamp(48px, 9.5vw, 78px);
  line-height: 1;
  text-align: center;
  text-shadow:
    0 4px 0 rgba(255, 255, 255, 0.9),
    0 7px 0 rgba(49, 95, 167, 0.13);
  box-shadow: none;
}

.final-actions {
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.final-restart,
.award-button,
.share-button {
  position: relative;
  left: auto;
  top: auto;
  width: auto;
  min-width: 190px;
  max-width: min(78vw, 260px);
  min-height: 54px;
  height: auto;
  padding: 12px 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff89a8 0%, #f45d86 100%);
  color: #ffffff;
  white-space: nowrap;
  box-shadow: 0 8px 0 #c94b72, 0 16px 28px rgba(201, 75, 114, 0.24);
  transform: none;
}

.award-button {
  background: linear-gradient(180deg, #8fc8ff 0%, #5ca4ee 100%);
  box-shadow: 0 8px 0 #417fc5, 0 16px 28px rgba(65, 127, 197, 0.22);
}

.share-button {
  background: linear-gradient(180deg, #ffe281 0%, #ffbd3f 100%);
  color: #8a5a16;
  box-shadow: 0 8px 0 #d49126, 0 16px 28px rgba(212, 145, 38, 0.22);
}

.final-decoration {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.final-star-a,
.final-star-b,
.final-star-c {
  width: 28px;
  height: 28px;
  background: #ffe281;
  clip-path: polygon(50% 0, 62% 34%, 98% 35%, 69% 57%, 79% 92%, 50% 72%, 21% 92%, 31% 57%, 2% 35%, 38% 34%);
  filter: drop-shadow(0 3px 0 rgba(49, 95, 167, 0.12));
}

.final-star-a {
  left: 10%;
  top: 19%;
  --twinkle-rotate: 0deg;
}

.final-star-b {
  right: 8%;
  top: 16%;
  background: #8fc8ff;
  --twinkle-rotate: 16deg;
  transform: rotate(16deg);
}

.final-star-c {
  left: 82%;
  top: 62%;
  width: 22px;
  height: 22px;
  background: #ff8faf;
  --twinkle-rotate: -12deg;
  transform: rotate(-12deg);
}

.final-confetti-a,
.final-confetti-b,
.final-confetti-c,
.final-confetti-d,
.final-confetti-e {
  width: 34px;
  height: 8px;
  border-radius: 999px;
  background: #ff8faf;
}

.final-confetti-a {
  left: 14%;
  top: 40%;
  transform: rotate(-22deg);
}

.final-confetti-b {
  right: 18%;
  top: 34%;
  background: #ffbd3f;
  transform: rotate(24deg);
}

.final-confetti-c {
  left: 22%;
  bottom: 18%;
  width: 28px;
  background: #8fc8ff;
  transform: rotate(18deg);
}

.final-confetti-d {
  right: 22%;
  bottom: 20%;
  width: 26px;
  background: #9ddf8a;
  transform: rotate(-28deg);
}

.final-confetti-e {
  left: 8%;
  top: 66%;
  width: 22px;
  background: #d7a2ff;
  transform: rotate(38deg);
}

.final-dot-a,
.final-dot-b {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ff8faf;
  box-shadow: 0 0 0 3px #ffffff;
}

.final-dot-a {
  left: 14%;
  top: 30%;
}

.final-dot-b {
  right: 13%;
  bottom: 32%;
  background: #8fc8ff;
}

.primary-button {
  min-width: 168px;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff89a8 0%, #f45d86 100%);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 8px 0 #c94b72, 0 16px 28px rgba(201, 75, 114, 0.24);
  cursor: pointer;
}

.primary-button:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #bf526e, 0 10px 20px rgba(191, 82, 110, 0.2);
}

.final-restart:active {
  transform: translateY(2px);
}

.final-restart:focus-visible {
  outline: 4px solid rgba(244, 93, 134, 0.6);
  outline-offset: 3px;
}

.world {
  z-index: 3;
}

.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.44) 0%, rgba(255, 255, 255, 0.1) 100%);
  border-top: 4px solid rgba(255, 255, 255, 0.78);
  pointer-events: none;
}

.cat {
  position: absolute;
  left: 9%;
  bottom: 16%;
  width: clamp(82px, 17vw, 138px);
  aspect-ratio: 582 / 686;
  transform: translateY(var(--jump-y, 0px));
  will-change: transform;
  z-index: 2;
}

.cat img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  animation: teciTeci 0.38s ease-in-out infinite alternate;
  filter: drop-shadow(0 10px 0 rgba(102, 111, 148, 0.11));
  pointer-events: none;
}

.cat-happy img {
  animation: happyCat 0.68s ease-out both;
}

.cat-invincible img {
  filter:
    drop-shadow(0 0 10px rgba(255, 226, 129, 0.95))
    drop-shadow(0 10px 0 rgba(102, 111, 148, 0.11));
}

.flower {
  position: absolute;
  z-index: 4;
  left: var(--flower-left);
  top: var(--flower-top);
  width: var(--flower-size);
  height: var(--flower-size);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: flowerBurst 0.9s ease-out forwards;
}

.flower::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 12%, var(--flower-color) 0 22%, transparent 23%),
    radial-gradient(circle at 86% 38%, var(--flower-color) 0 22%, transparent 23%),
    radial-gradient(circle at 72% 84%, var(--flower-color) 0 22%, transparent 23%),
    radial-gradient(circle at 28% 84%, var(--flower-color) 0 22%, transparent 23%),
    radial-gradient(circle at 14% 38%, var(--flower-color) 0 22%, transparent 23%),
    radial-gradient(circle at 50% 50%, #ffe889 0 16%, transparent 17%);
  animation: flowerSpin 0.9s ease-out forwards;
}

.apple-sparkle {
  position: absolute;
  z-index: 4;
  left: var(--sparkle-left);
  top: var(--sparkle-top);
  width: var(--sparkle-size);
  height: var(--sparkle-size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 45% 45%, #ffffff 0 18%, transparent 19%),
    var(--sparkle-color);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.78);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: appleSparkle 0.82s ease-out forwards;
}

.item {
  position: absolute;
  z-index: 4;
  left: 0;
  bottom: 18%;
  width: clamp(36px, 6vw, 52px);
  height: clamp(34px, 5.4vw, 48px);
  will-change: transform;
}

.item::before,
.item::after {
  content: "";
  position: absolute;
}

.item-stone {
  border-radius: 48% 52% 45% 55%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.5) 0 16%, transparent 17%),
    linear-gradient(145deg, #b7b2ad 0%, #8f8b87 100%);
  box-shadow: inset -6px -5px 0 rgba(93, 91, 93, 0.16), 0 6px 0 rgba(87, 80, 73, 0.1);
}

.item-apple {
  width: clamp(34px, 5.8vw, 50px);
  border-radius: 46% 54% 52% 48% / 44% 46% 54% 56%;
  background:
    radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.55) 0 13%, transparent 14%),
    linear-gradient(145deg, #ff7a8a 0%, #dd4357 100%);
  box-shadow: inset -6px -5px 0 rgba(150, 35, 53, 0.15), 0 6px 0 rgba(116, 52, 52, 0.1);
}

.item-apple::before {
  top: -10px;
  left: 48%;
  width: 8px;
  height: 16px;
  border-radius: 999px;
  background: #7c5b3b;
  transform: rotate(18deg);
}

.item-apple::after {
  top: -12px;
  left: 58%;
  width: 19px;
  height: 11px;
  border-radius: 70% 20% 70% 20%;
  background: #70bf78;
  transform: rotate(-18deg);
}

.item-trash {
  width: clamp(34px, 5.6vw, 48px);
  height: clamp(38px, 6vw, 54px);
  bottom: 19%;
  border-radius: 8px 8px 12px 12px;
  background:
    linear-gradient(90deg, transparent 0 24%, rgba(78, 90, 112, 0.28) 24% 31%, transparent 31% 46%, rgba(78, 90, 112, 0.22) 46% 53%, transparent 53% 70%, rgba(78, 90, 112, 0.22) 70% 77%, transparent 77%),
    linear-gradient(145deg, #aeb8c5 0%, #8793a4 100%);
  box-shadow: inset -5px -5px 0 rgba(68, 77, 93, 0.18), 0 6px 0 rgba(68, 77, 93, 0.1);
}

.item-trash-hop {
  border-radius: 10px 10px 16px 12px;
}

.item-trash-roll {
  width: clamp(38px, 6vw, 54px);
  height: clamp(34px, 5.6vw, 50px);
  border-radius: 45% 55% 48% 52%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.38) 0 13%, transparent 14%),
    linear-gradient(145deg, #b9c4d0 0%, #7b8798 100%);
}

.item-trash-wobble {
  border-radius: 14px 10px 18px 8px;
  filter: drop-shadow(0 5px 0 rgba(68, 77, 93, 0.12));
}

.item-trash::before {
  top: -9px;
  left: 8px;
  right: 8px;
  height: 8px;
  border-radius: 999px 999px 2px 2px;
  background: #6f7b90;
}

.item-trash::after {
  top: -15px;
  left: 34%;
  width: 32%;
  height: 7px;
  border-radius: 999px 999px 0 0;
  border: 3px solid #6f7b90;
  border-bottom: 0;
}

.item-pizza {
  bottom: 19%;
  width: clamp(74px, 10vw, 104px);
  height: clamp(56px, 7.8vw, 78px);
  border-radius: 8px;
  background: url("assets/pizza.png") center / 118% auto no-repeat;
  filter: drop-shadow(0 7px 0 rgba(129, 83, 44, 0.1));
}

.item-pizza::before {
  content: none;
}

.item-rare-pizza {
  filter:
    brightness(1.12)
    saturate(1.35)
    drop-shadow(0 0 14px rgba(255, 226, 129, 0.98))
    drop-shadow(0 7px 0 rgba(129, 83, 44, 0.1));
  animation: rarePizzaGlow 0.62s ease-in-out infinite alternate;
}

.item-rare-pizza::before {
  content: "RARE";
  position: absolute;
  z-index: 2;
  left: 50%;
  top: -12px;
  padding: 3px 7px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe281 0%, #ffbd3f 100%);
  color: #f45d86;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(49, 95, 167, 0.14);
  transform: translateX(-50%) rotate(-5deg);
}

.item-rare-pizza::after {
  content: "";
  position: absolute;
  z-index: 1;
  right: 6px;
  top: 6px;
  width: 16px;
  height: 16px;
  background: #ffe281;
  clip-path: polygon(50% 0, 62% 34%, 98% 35%, 69% 57%, 79% 92%, 50% 72%, 21% 92%, 31% 57%, 2% 35%, 38% 34%);
  filter: drop-shadow(0 2px 0 rgba(49, 95, 167, 0.12));
  animation: rarePizzaStar 0.72s ease-in-out infinite alternate;
}

.item-trash-fast {
  filter: drop-shadow(0 0 8px rgba(244, 93, 134, 0.5));
}

.obstacle-warning {
  position: absolute;
  z-index: 7;
  right: 16px;
  bottom: 30%;
  display: grid;
  place-items: center;
  width: clamp(34px, 5vw, 48px);
  height: clamp(34px, 5vw, 48px);
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff7cf 0%, #ffe281 100%);
  color: #f45d86;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 6px 0 rgba(49, 95, 167, 0.14);
  pointer-events: none;
  animation: obstacleWarning 1.08s ease-out both;
}

.item-collected {
  animation: collect 0.28s ease-out forwards;
}

@keyframes teciTeci {
  from {
    transform: translateY(0) rotate(-1.5deg);
  }
  to {
    transform: translateY(-7px) rotate(1.5deg);
  }
}

@keyframes happyCat {
  0% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
  35% {
    transform: translateY(-20px) scale(1.1) rotate(-5deg);
  }
  68% {
    transform: translateY(5px) scale(0.96, 1.04) rotate(4deg);
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

@keyframes flowerBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(
        calc(-50% + var(--flower-x)),
        calc(-50% + var(--flower-y))
      )
      scale(1.18);
  }
}

@keyframes flowerSpin {
  100% {
    transform: rotate(var(--flower-rotate));
  }
}

@keyframes appleSparkle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(
        calc(-50% + var(--sparkle-x)),
        calc(-50% + var(--sparkle-y))
      )
      scale(1.12);
  }
}

@keyframes rarePizzaGlow {
  from {
    opacity: 0.9;
  }
  to {
    opacity: 1;
  }
}

@keyframes rarePizzaStar {
  from {
    transform: scale(0.9) rotate(-8deg);
  }
  to {
    transform: scale(1.16) rotate(10deg);
  }
}

@keyframes obstacleWarning {
  0% {
    opacity: 0;
    transform: translateX(10px) scale(0.65);
  }
  22%,
  72% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-6px) scale(0.92);
  }
}

@keyframes supporterCheer {
  0% {
    opacity: 0;
    transform: translate(28%, 12%) scale(0.85) rotate(0deg);
  }
  14% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(-2deg);
  }
  28% {
    transform: translate(0, -8px) scale(1.04) rotate(2deg);
  }
  42%,
  76% {
    opacity: 1;
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(34%, 12%) scale(0.88) rotate(0deg);
  }
}

@keyframes startTip {
  0% {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.86);
  }
  14%,
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58%) scale(1.03);
  }
}

@keyframes bonusBanner {
  0% {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.72);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
  30%,
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -54%) scale(1.04);
  }
}

@keyframes rarePizzaNotice {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.92);
  }
  18%,
  76% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-6px) scale(1.03);
  }
}

@keyframes stageBanner {
  0% {
    opacity: 0;
    transform: translate(-50%, -28px) scale(0.84);
  }
  18%,
  72% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -18px) scale(1.04);
  }
}

@keyframes compactNotice {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  18%,
  76% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-4px) scale(1.02);
  }
}

@keyframes clearSparkle {
  0% {
    opacity: 0.35;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.02);
  }
  100% {
    opacity: 0.35;
    transform: scale(0.98);
  }
}

@keyframes finalTwinkle {
  0%,
  100% {
    opacity: 0.62;
    transform: scale(0.92) rotate(var(--twinkle-rotate, 0deg));
  }
  50% {
    opacity: 1;
    transform: scale(1.12) rotate(var(--twinkle-rotate, 0deg));
  }
}

@keyframes collect {
  to {
    opacity: 0;
    transform: translateX(var(--item-x, 0px)) translateY(-18px) scale(1.35) rotate(16deg);
  }
}

@media (max-width: 680px) {
  .game-shell {
    padding: 0;
  }

  .game {
    width: 100vw;
    height: 100svh;
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
    aspect-ratio: auto;
  }

  .hud {
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    gap: 6px;
    align-items: flex-start;
  }

  .mini-title {
    display: none;
  }

  .stage-pill {
    width: clamp(220px, 62vw, 300px);
    max-width: 64vw;
    min-height: 62px;
    overflow: visible;
    padding: 23px 52px 11px 46px;
    font-size: clamp(13px, 4vw, 18px);
    text-overflow: ellipsis;
    transform: translateY(-6px);
  }

  .score {
    min-width: 94px;
    gap: 5px;
    padding: 5px 7px;
    border-width: 3px;
    font-size: 11px;
  }

  .score-icon {
    width: 19px;
    height: 16px;
  }

  .guard-status {
    top: max(58px, calc(env(safe-area-inset-top) + 54px));
    right: 10px;
    padding: 6px 9px;
    border-width: 3px;
    font-size: 11px;
  }

  .rare-pizza-notice {
    left: 12px;
    top: max(60px, calc(env(safe-area-inset-top) + 56px));
    font-size: 14px;
  }

  .cat {
    left: 8%;
    bottom: 15%;
    width: clamp(78px, 28vw, 124px);
  }

  .ground {
    height: 16%;
  }

  .item {
    bottom: 18%;
  }

  .item-trash,
  .item-pizza {
    bottom: 19%;
  }

  .item-pizza {
    width: clamp(70px, 18vw, 94px);
    height: clamp(52px, 13vw, 70px);
  }

  .supporter {
    top: 14%;
    right: 1%;
  }

  .supporter img {
    width: clamp(72px, 24vw, 112px);
  }

  .supporter-speech {
    max-width: 210px;
  }

  .bonus-banner {
    top: 36%;
    width: min(92%, 420px);
  }

  .bonus-status {
    top: auto;
    bottom: max(10px, calc(env(safe-area-inset-bottom) + 8px));
  }

  .stage-banner {
    top: 18%;
    width: min(92%, 440px);
    font-size: clamp(18px, 6vw, 28px);
  }

  .stage-banner.compact {
    top: max(82px, calc(env(safe-area-inset-top) + 76px));
    right: 12px;
    max-width: 56vw;
    font-size: clamp(12px, 3.2vw, 15px);
  }

  .stage-banner-image {
    max-height: 18vh;
  }

  .start-tip {
    width: min(92%, 360px);
  }

  .start-tip img {
    max-height: 56vh;
  }

  .title-logo {
    width: min(92vw, 390px);
    max-height: 44vh;
  }

  .screen {
    padding: 14px;
    gap: 14px;
  }

  .story-card {
    width: min(92vw, 390px);
    max-height: calc(100svh - 44px);
    gap: 8px;
    padding: 12px;
    border-width: 5px;
    border-radius: 24px;
  }

  .story-stage-image {
    width: min(90%, 300px);
    max-height: 18vh;
  }

  .story-text {
    font-size: clamp(11px, 3vw, 14px);
    line-height: 1.32;
  }

  .story-ok {
    min-height: 38px;
    min-width: 96px;
    padding: 8px 16px;
  }

  .game-over-screen {
    padding: 10px;
  }

  .final-panel {
    width: min(92vw, 390px);
    max-height: calc(100svh - 28px);
    min-height: 0;
    gap: 8px;
    padding: 14px;
    border-width: 5px;
    border-radius: 24px;
  }

  .final-title {
    width: min(86%, 300px);
  }

  .final-score {
    width: min(74%, 230px);
    min-height: 96px;
    padding: 10px;
    border-width: 4px;
  }

  .final-score-label {
    padding: 5px 16px;
    font-size: 15px;
  }

  .final-score-number {
    min-width: 78px;
    font-size: clamp(40px, 12vw, 58px);
  }

  .final-restart {
    min-width: 174px;
    min-height: 46px;
    padding: 10px 18px;
    font-size: 14px;
  }

  .final-actions {
    gap: 9px;
  }

  .award-button {
    min-width: 148px;
    min-height: 46px;
    padding: 10px 14px;
    font-size: 14px;
  }

  .share-button {
    min-width: 148px;
    min-height: 46px;
    padding: 10px 14px;
    font-size: 14px;
  }

  .game-over-screen.clear-screen .final-panel {
    width: min(94vw, 400px);
    max-height: calc(100svh - 24px);
    min-height: 0;
    gap: 8px;
    padding: 12px 10px;
  }

  .game-over-screen.clear-screen .final-title {
    width: min(62%, 230px);
  }

  .clear-party {
    width: min(90%, 310px);
    margin: 0;
    border-width: 4px;
    border-radius: 18px;
  }

  .clear-party img {
    height: auto;
    object-fit: contain;
  }

  .game-over-screen.clear-screen .final-score {
    width: min(68%, 190px);
    padding: 5px 8px;
    gap: 6px;
  }

  .game-over-screen.clear-screen .final-score-label {
    font-size: 13px;
    padding: 4px 12px;
  }

  .game-over-screen.clear-screen .final-score-number {
    min-width: 50px;
    font-size: clamp(24px, 7vw, 34px);
  }

  .game-over-screen.clear-screen .final-restart {
    margin-top: 4px;
    min-height: 40px;
    padding: 8px 16px;
    font-size: 13px;
  }

  .game-over-screen.award-screen .final-panel {
    width: min(96vw, 430px);
    gap: 8px;
    padding: 10px;
  }

  .award-card {
    width: 100%;
    border-width: 4px;
    border-radius: 18px;
  }

  .award-score {
    bottom: clamp(13px, 5vw, 26px);
    min-width: 72%;
    padding: 8px 14px;
    border-width: 3px;
    font-size: clamp(15px, 5vw, 22px);
  }
}
