:root {
  --blue: #2f82ff;
  --red: #ff334f;
  --green: #1fd556;
  --yellow: #ffbc2e;
  --ink: #172033;
  --panel: #c7d0ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #202636;
  font-family: Impact, Haettenschweiler, "Arial Black", system-ui, sans-serif;
  color: white;
  user-select: none;
  touch-action: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#shell {
  position: relative;
  width: min(100vw, 720px);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #9edf38;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.4);
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  background: #9edf38;
}

.hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 18px;
  right: 18px;
  height: 58px;
  display: grid;
  grid-template-columns: 58px 1fr 58px auto;
  gap: 12px;
  align-items: center;
  pointer-events: none;
}

.hud button,
.hud .coin-pill,
.bottom-hud button,
.start-panel,
.modal {
  pointer-events: auto;
}

.icon-btn {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: #f4f8ff;
  color: var(--blue);
  font-size: 48px;
  line-height: 40px;
  text-shadow: 0 3px 0 #15549b;
  box-shadow: inset 0 -6px 0 #bdd6ff, 0 5px 0 rgba(20, 54, 98, 0.45);
}

.progress-shell {
  position: relative;
  height: 46px;
  overflow: hidden;
  border: 5px solid white;
  border-radius: 999px;
  background: #8e98aa;
  box-shadow: 0 4px 0 rgba(42, 48, 68, 0.45);
}

.progress-bar {
  position: absolute;
  inset: 0;
  display: flex;
}

.progress-shell strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(18px, 5.5vw, 32px);
  letter-spacing: 0;
  text-shadow: 0 3px 0 #24456e, 2px 0 0 #24456e, -2px 0 0 #24456e;
}

.pill-btn,
.coin-pill {
  min-width: 58px;
  height: 44px;
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 18px;
  background: rgba(33, 23, 21, 0.72);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  font-size: 24px;
  text-shadow: 0 3px 0 #000;
}

.coin {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 62% 35%, #ffe87e 0 18%, #ffc22d 19% 60%, #ee8b12 61%);
  border: 3px solid #8b4a0f;
  box-shadow: inset 4px 0 0 rgba(255, 255, 255, 0.28);
}

.coin.big {
  width: 62px;
  height: 62px;
}

.bottom-hud {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.boost-btn,
.small-action,
.play-btn,
.modal-primary {
  border-radius: 18px;
  background: linear-gradient(#28ec4e, #08a827);
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.18), 0 5px 0 rgba(0, 80, 20, 0.45);
  border: 3px solid rgba(0, 117, 24, 0.7);
  text-shadow: 0 3px 0 #05320d, 2px 0 0 #05320d, -2px 0 0 #05320d;
}

.boost-btn {
  width: 150px;
  height: 76px;
  display: grid;
  align-content: center;
  color: white;
}

.boost-btn span {
  color: #ffec6b;
  font-size: 24px;
}

.boost-btn strong {
  font-size: 26px;
}

.small-action {
  min-width: 88px;
  height: 48px;
  padding: 0 18px;
  font-size: 20px;
}

.start-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: max(18px, env(safe-area-inset-top)) 22px max(76px, env(safe-area-inset-bottom));
  background: linear-gradient(rgba(30, 39, 56, 0.92) 0 92px, transparent 92px 63%, rgba(5, 120, 22, 0.72));
}

.start-panel.hidden,
.hidden {
  display: none;
}

.player-bar {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 18px;
  right: 18px;
  height: 66px;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 12px;
  align-items: center;
  color: white;
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(#77b9ff 0 32%, #1e61c9 33% 56%, #ffd0a3 57%);
  border: 4px solid white;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}

.player-bar strong,
.power {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-radius: 12px;
  background: rgba(18, 24, 38, 0.55);
  font-size: 28px;
  text-shadow: 0 3px 0 #000;
}

.power b {
  color: #a2ff1c;
  margin-left: 8px;
}

.start-title {
  margin: 0 auto auto;
  padding-top: 26vh;
  font-size: clamp(40px, 10vw, 72px);
  text-shadow: 0 4px 0 #111, 3px 0 0 #111, -3px 0 0 #111;
}

#recommended {
  align-self: center;
  margin: 0 0 14px;
  padding: 11px 22px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.34);
  font-family: system-ui, sans-serif;
  font-weight: 800;
}

.play-btn {
  align-self: center;
  width: min(88%, 380px);
  height: 82px;
  font-size: 50px;
}

.modal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 8, 12, 0.54);
}

.modal.hidden {
  display: none;
}

.hero-badge {
  width: 214px;
  height: 214px;
  margin-bottom: -10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 55%, #ffd2a3 0 16%, transparent 17%),
    linear-gradient(#67b0ff 0 35%, #1c65d1 36% 52%, #192338 53%);
  box-shadow: 0 0 38px #ffd86a;
}

.modal-header {
  z-index: 1;
  width: min(100%, 650px);
  height: 86px;
  display: grid;
  place-items: center;
  border-radius: 18px 18px 8px 8px;
  background: #356fee;
  border: 4px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.13);
  font-size: clamp(36px, 11vw, 60px);
  text-shadow: 0 4px 0 #000, 3px 0 0 #000, -3px 0 0 #000;
}

.modal.defeat .modal-header {
  background: #c83248;
}

.modal-card {
  width: min(94%, 650px);
  padding: 28px 24px 32px;
  border-radius: 0 0 28px 28px;
  background: var(--panel);
  color: #31384d;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18), 0 5px 0 rgba(0, 0, 0, 0.2);
  text-align: center;
}

.modal-card h2 {
  margin: 0 0 22px;
  font-size: 34px;
}

.reward {
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #54b43b;
  border: 4px solid #1f5e1d;
  color: white;
  font-size: 38px;
  text-shadow: 0 3px 0 #000;
}

.modal-primary {
  width: min(100%, 340px);
  height: 66px;
  margin: 0 auto 14px;
  display: block;
  font-size: 34px;
}

.text-btn {
  background: transparent;
  color: white;
  font-size: 26px;
  text-shadow: 0 3px 0 #333;
}

@media (min-aspect-ratio: 9 / 14) {
  #shell {
    width: min(100vw, calc(100dvh * 0.5625));
  }
}
