/* ---------- RESET ---------- */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/*
  Do not set html/body here: style.css (loaded first) owns overflow, height,
  and fixed body for the game. This file loads after and would override that,
  which on iOS PWA can restore scrolling and show a white bar at the bottom.
*/

.mission-prompt,
.mission-action-btn,
.skip-intro-btn {
  font-family: "Nunito", sans-serif;
}

/* ---------- PREVIEW BACKGROUND ---------- */

body.mission-preview {
  min-height: 100vh;
  background: #5f5cb8;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

/* ---------- MODAL ---------- */

.mission-prompt {
  position: absolute;
  inset: 0;
  z-index: 135;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
  padding: 0;
  overflow: hidden;
}

.mission-prompt.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.mission-prompt-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(57, 48, 107, 0.25);
}

/* ---------- IMAGE MODAL ---------- */

.mission-modal-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
}

.mission-modal-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

/* ---------- BUTTONS ---------- */

.mission-modal-actions {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 87px);
  width: min(86%, 360px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mission-action-btn {
  width: 100%;
  min-height: 58px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 23px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  text-align: center;
  transition: transform 0.1s ease;
}

.mission-action-btn-primary {
  position: relative;
  overflow: hidden;
  background: #5b59bf;
  color: #ffffff;
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.16),
    0 2px 0 rgba(0, 0, 0, 0.06);
  animation: missionPulse 1.8s ease-in-out infinite;
}

.mission-action-btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -35%;
  width: 28%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.32) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-20deg);
  animation: missionShine 2.2s ease-in-out infinite;
}

.mission-action-btn-secondary {
  background: #e7e7e7;
  color: #4a4a4a;
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.08),
    0 2px 0 rgba(0, 0, 0, 0.04);
}

.mission-action-btn:active {
  transform: translateY(1px);
}

.mission-action-btn-primary:active {
  transform: translateY(1px) scale(1.01);
}

@keyframes missionPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(0) scale(1.02);
  }
}

@keyframes missionShine {
  0% {
    left: -35%;
  }

  55% {
    left: -35%;
  }

  100% {
    left: 125%;
  }
}

/* ---------- SKIP BUTTON ---------- */

.skip-intro-btn {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  z-index: 220;

  min-height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, 0.58);
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.skip-intro-btn:active {
  transform: translateY(1px);
}

/* ---------- ADAPTIVE ---------- */

@media (max-width: 430px) {
  .mission-modal-actions {
    width: min(86%, 340px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 58px);
    gap: 10px;
  }

  .mission-action-btn {
    min-height: 54px;
    font-size: 21px;
  }

  .skip-intro-btn {
    min-height: 34px;
    padding: 0 13px;
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .mission-modal-actions {
    width: min(88%, 320px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 50px);
    gap: 8px;
  }

  .mission-action-btn {
    min-height: 50px;
    font-size: 18px;
  }

  .skip-intro-btn {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    right: calc(env(safe-area-inset-right, 0px) + 10px);
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }
}

/* ---------- TELEGRAM MINI APP ONLY ---------- */

html.tg-app .mission-modal-actions,
body.tg-app .mission-modal-actions {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
}

@media (max-width: 430px) {
  html.tg-app .mission-modal-actions,
  body.tg-app .mission-modal-actions {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  }
}

@media (max-width: 360px) {
  html.tg-app .mission-modal-actions,
  body.tg-app .mission-modal-actions {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  }
}