:root {
  color-scheme: light;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
  background: #8bd8ff;
  color: #243042;
}

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

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 560px;
  overflow: hidden;
  background: #8bd8ff;
}

#game {
  display: block;
  width: 100vw;
  height: 100dvh;
}

.hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  z-index: 5;
  display: grid;
  grid-template-columns: 76px 1fr 54px;
  gap: 8px;
  align-items: start;
  pointer-events: none;
}

.hud.hidden {
  display: none;
}

.score-pill,
.bubble-pill {
  border: 3px solid #fff;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff7be 0%, #ffd767 100%);
  box-shadow: 0 5px 0 #d79732, 0 10px 18px rgba(74, 95, 119, 0.22);
  text-align: center;
  -webkit-text-stroke: 3px #fff;
  paint-order: stroke fill;
}

.score-pill {
  justify-self: center;
  min-width: 142px;
  padding: 6px 14px 8px;
}

.bubble-pill {
  position: relative;
  padding: 6px 8px 7px;
  background: linear-gradient(180deg, #ccfbff 0%, #74d8ff 100%);
  box-shadow: 0 5px 0 #3aa0c3, 0 10px 18px rgba(74, 95, 119, 0.2);
}

#powerRing {
  position: absolute;
  left: -4px;
  top: 44px;
  width: 42px;
  height: 42px;
  pointer-events: none;
}

.hud span,
.result-grid span {
  display: block;
  font-size: 10px;
  font-weight: 1000;
  line-height: 1;
}

.hud strong {
  display: block;
  margin-top: 1px;
  color: #2d3850;
  font-size: 27px;
  font-weight: 1000;
  line-height: 0.95;
}

.bubble-pill strong {
  font-size: 22px;
}

.icon-button,
.sound-button,
.primary,
.secondary {
  border: 3px solid #fff;
  border-radius: 18px;
  font-weight: 1000;
  cursor: pointer;
  transform: translateY(0) scale(1);
  transition: transform 90ms ease, box-shadow 90ms ease;
}

.icon-button:active,
.sound-button:active,
.primary:active,
.secondary:active {
  transform: translateY(5px) scale(0.93);
}

.icon-button {
  width: 52px;
  height: 48px;
  justify-self: end;
  pointer-events: auto;
  background: linear-gradient(180deg, #fff 0%, #d6f7ff 100%);
  box-shadow: 0 5px 0 #76aebf, 0 10px 18px rgba(74, 95, 119, 0.2);
  color: #305166;
  font-size: 24px;
  line-height: 1;
}

.icon-button svg,
.sound-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:active {
  box-shadow: 0 1px 0 #76aebf, 0 5px 10px rgba(74, 95, 119, 0.18);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(26px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.overlay.hidden,
.hidden {
  display: none;
}

.start-overlay {
  justify-content: flex-end;
  gap: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 238, 168, 0.36) 62%, rgba(255, 149, 155, 0.45) 100%);
}

.logo-wrap {
  width: min(100%, 360px);
  margin-bottom: auto;
  padding-top: min(11dvh, 88px);
  text-align: center;
}

.logo-kicker {
  margin: 0 0 3px;
  color: #ff5f8f;
  font-size: 16px;
  font-weight: 1000;
  line-height: 1;
  -webkit-text-stroke: 3px #fff;
  paint-order: stroke fill;
  text-shadow: 0 7px 12px rgba(112, 71, 94, 0.25);
}

h1,
h2 {
  margin: 0;
  color: #25324b;
  font-weight: 1000;
  line-height: 0.96;
  text-align: center;
}

h1 {
  font-size: 60px;
  -webkit-text-stroke: 8px #fff;
  paint-order: stroke fill;
  text-shadow: 0 8px 0 #f5ac48, 0 15px 20px rgba(75, 74, 112, 0.26);
}

h2 {
  font-size: 34px;
  -webkit-text-stroke: 5px #fff;
  paint-order: stroke fill;
}

.character-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 78%;
  width: min(100%, 390px);
  gap: 14px;
  overflow-x: auto;
  padding: 4px 11% 10px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.character-strip::-webkit-scrollbar {
  display: none;
}

.character-card {
  min-height: 218px;
  padding: 12px 14px 14px;
  scroll-snap-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #dff8ff 100%);
  box-shadow: 0 8px 0 #70b3c7, 0 16px 22px rgba(68, 94, 121, 0.22);
}

.character-card.selected {
  background: linear-gradient(180deg, #fff8d1 0%, #ffd6e3 100%);
  box-shadow: 0 8px 0 #d96a8b, 0 16px 22px rgba(91, 68, 99, 0.25);
}

.character-card.locked img {
  filter: grayscale(0.6) opacity(0.62) drop-shadow(0 8px 0 rgba(44, 70, 84, 0.13));
}

.character-card:active {
  box-shadow: 0 3px 0 #70b3c7, 0 8px 14px rgba(68, 94, 121, 0.18);
}

.character-card.selected:active {
  box-shadow: 0 3px 0 #d96a8b, 0 8px 14px rgba(91, 68, 99, 0.18);
}

.character-card img {
  display: block;
  width: 126px;
  height: 142px;
  margin: 2px auto 10px;
  object-fit: contain;
  filter: drop-shadow(0 8px 0 rgba(44, 70, 84, 0.13));
}

.character-card span {
  display: block;
  color: #25324b;
  font-size: 24px;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  -webkit-text-stroke: 3px #fff;
  paint-order: stroke fill;
}

.character-card small {
  display: block;
  margin-top: 8px;
  color: #486174;
  font-size: 15px;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
}

.lock-icon {
  font-size: 0;
}

.lock-icon::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 11px;
  margin-right: 5px;
  border: 3px solid currentColor;
  border-radius: 3px;
  vertical-align: -2px;
}

.lock-icon::after {
  content: "";
  display: inline-block;
  width: 9px;
  height: 8px;
  margin-left: -19px;
  border: 3px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  vertical-align: 7px;
}

.big-button {
  width: min(100%, 326px);
  min-height: 64px;
  padding: 0 22px;
  font-size: 27px;
  line-height: 1;
}

.primary {
  background: linear-gradient(180deg, #ff9fc2 0%, #ff5f8f 100%);
  box-shadow: 0 8px 0 #bc3f68, 0 16px 22px rgba(95, 52, 87, 0.26);
  color: #fff;
  text-shadow: 0 3px 0 #bc3f68;
}

.primary:active {
  box-shadow: 0 3px 0 #bc3f68, 0 8px 14px rgba(95, 52, 87, 0.2);
}

.secondary {
  margin-top: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #e2f8ff 100%);
  box-shadow: 0 8px 0 #74acbf, 0 16px 22px rgba(68, 94, 121, 0.2);
  color: #315066;
}

.secondary:active {
  box-shadow: 0 3px 0 #74acbf, 0 8px 14px rgba(68, 94, 121, 0.16);
}

.sound-button {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 52px;
  height: 50px;
  background: linear-gradient(180deg, #ffffff 0%, #dff8ff 100%);
  box-shadow: 0 6px 0 #70b3c7, 0 12px 16px rgba(68, 94, 121, 0.2);
  color: #315066;
  font-size: 24px;
}

.sound-button[aria-pressed="true"] {
  color: #be4169;
}

.sound-button .sound-off,
.sound-button[aria-pressed="true"] .sound-on {
  display: none;
}

.sound-button[aria-pressed="true"] .sound-off {
  display: inline;
}

.countdown {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 132px;
  font-weight: 1000;
  line-height: 1;
  -webkit-text-stroke: 10px #ff6f9e;
  paint-order: stroke fill;
  text-shadow: 0 12px 0 #bb3c66, 0 24px 26px rgba(80, 56, 94, 0.26);
  pointer-events: none;
}

.countdown.hidden {
  display: none;
}

.countdown.pop {
  animation: countdown-pop 560ms cubic-bezier(0.2, 1.42, 0.35, 1) both;
}

.pause-overlay {
  justify-content: center;
  background: rgba(68, 91, 125, 0.28);
}

.tutorial-overlay {
  z-index: 13;
  justify-content: center;
  gap: 14px;
  background: rgba(58, 76, 108, 0.18);
}

.tutorial-overlay p {
  margin: 0;
  color: #fff;
  font-size: 38px;
  font-weight: 1000;
  line-height: 1;
  -webkit-text-stroke: 6px #ff5f8f;
  paint-order: stroke fill;
  text-shadow: 0 8px 0 #bd416b, 0 16px 18px rgba(64, 62, 100, 0.25);
}

.tap-hand {
  width: 62px;
  height: 86px;
  border: 6px solid #fff;
  border-radius: 28px 28px 34px 34px;
  background: #ffd37a;
  box-shadow: 0 8px 0 #d28a36, 0 16px 20px rgba(58, 70, 94, 0.24);
  animation: tap-hand 780ms ease-in-out infinite;
}

.tap-hand::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 48px;
  margin: -32px 0 0 15px;
  border: 6px solid #fff;
  border-bottom: 0;
  border-radius: 17px 17px 0 0;
  background: #ffd37a;
}

.revive-overlay {
  z-index: 14;
  justify-content: center;
  background: rgba(43, 57, 83, 0.34);
}

.revive-panel {
  display: grid;
  gap: 12px;
  text-align: center;
}

#reviveCountdown {
  color: #ff5f8f;
  font-size: 58px;
  font-weight: 1000;
  line-height: 1;
  -webkit-text-stroke: 6px #fff;
  paint-order: stroke fill;
}

.over-overlay {
  justify-content: flex-end;
  background: rgba(49, 66, 92, 0.16);
}

.sheet {
  width: min(100%, 350px);
  padding: 24px 18px 20px;
  border: 4px solid #fff;
  border-radius: 26px 26px 18px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fff2b9 100%);
  box-shadow: 0 10px 0 #d39a37, 0 22px 30px rgba(60, 70, 96, 0.25);
}

.over-panel {
  animation: sheet-up 460ms cubic-bezier(0.18, 1.2, 0.34, 1) both;
}

.pause-panel {
  display: grid;
  gap: 22px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 18px;
}

.result-grid div {
  min-width: 0;
  padding: 12px 8px;
  border: 3px solid #fff;
  border-radius: 18px;
  background: linear-gradient(180deg, #dcf8ff 0%, #a6e4ff 100%);
  box-shadow: inset 0 -5px 0 rgba(59, 142, 173, 0.18);
  text-align: center;
}

.result-grid strong {
  display: block;
  margin-top: 3px;
  color: #25324b;
  font-size: 34px;
  font-weight: 1000;
  line-height: 1;
  -webkit-text-stroke: 3px #fff;
  paint-order: stroke fill;
}

.new-best {
  margin: -4px 0 12px;
  color: #ff5f8f;
  font-size: 28px;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  -webkit-text-stroke: 4px #fff;
  paint-order: stroke fill;
  animation: best-pop 780ms cubic-bezier(0.2, 1.42, 0.35, 1) infinite alternate;
}

.mission-list {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.mission-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  align-items: center;
  color: #2c3d55;
  font-size: 13px;
  font-weight: 900;
}

.mission-row strong {
  color: #ff5f8f;
}

.mission-bar {
  grid-column: 1 / -1;
  height: 9px;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 999px;
  background: rgba(81, 131, 158, 0.18);
}

.mission-bar i {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #74d8ff 0%, #ff8eb5 100%);
}

@keyframes countdown-pop {
  0% {
    opacity: 0;
    transform: scale(0.45);
  }

  18% {
    opacity: 1;
    transform: scale(1.18);
  }

  100% {
    opacity: 0;
    transform: scale(0.86);
  }
}

@keyframes sheet-up {
  0% {
    opacity: 0;
    transform: translateY(100%);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tap-hand {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  45% {
    transform: translateY(18px) scale(0.92);
  }
}

@keyframes best-pop {
  from {
    transform: scale(0.96) rotate(-1deg);
  }

  to {
    transform: scale(1.04) rotate(1deg);
  }
}

@media (max-height: 700px) {
  .logo-wrap {
    padding-top: 56px;
  }

  h1 {
    font-size: 48px;
  }

  .character-card {
    min-height: 182px;
  }

  .character-card img {
    width: 102px;
    height: 114px;
  }
}
