/* ============================================
   Score Popup - Base Styles
   ============================================ */

body.score-popup-open {
  overflow: hidden;
}

.score-popup {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(20px, 4vw, 80px);
  background: rgba(0, 21, 67, 0.85);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 10000;
  font-family: "Usual", sans-serif;
  overflow-y: auto;
  color: #001543;
}

.score-popup.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.score-popup__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.score-popup__dialog {
  position: relative;
  width: min(1040px, 100%);
  max-height: calc(100vh - 80px);
  margin: 0 auto;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-popup__frame {
  position: relative;
  background: #4cbcc0;
  border: 6px solid #0f2752;
  padding: clamp(92px, 7vw, 110px);
  padding-bottom: 0;
  box-shadow: 0 60px 0 rgba(8, 22, 58, 0.35);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

.score-popup__content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ============================================
   Close Button
   ============================================ */

.score-popup__close {
  position: absolute;
  right: clamp(16px, 4vw, 40px);
  top: clamp(16px, 4vw, 40px);
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
  z-index: 5;
  padding: 0;
}

.score-popup__close img {
  width: 50px;
  height: 50px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.score-popup__close::before {
  content: "";
  position: absolute;
  top: -16px;
  right: -16px;
  bottom: -16px;
  left: -16px;
  pointer-events: none;
  z-index: 0;
}

.score-popup__close:hover,
.score-popup__close:focus-visible {
  transform: scale(1.05);
  transition: transform 0.2s ease;
  outline: none;
}

/* ============================================
   Header Section (Stars, Eyebrow, Headline)
   ============================================ */

.score-popup__header {
  position: relative;
  padding-bottom: 20px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}

.score-popup__stars {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100%, 900px);
  height: 380px;
  background-image: url("../img/high-score-popup-assets/stars-background.gif");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center center;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.score-popup.is-open .score-popup__stars {
  animation: scoreStarsZoom 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

@keyframes scoreStarsZoom {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.85);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.score-popup__eyebrow {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-top: 30px;
  letter-spacing: 0.2em;
  font-family: "bitcount-prop-single-square", sans-serif;
  font-weight: 700;
  position: relative;
  z-index: 2;
}

.score-popup__headline {
  font-size: clamp(2.5rem, 7vw, 4rem);
  letter-spacing: 0.08em;
  font-family: "bitcount-prop-single-square", sans-serif;
  font-weight: 700;
  line-height: 1;
  position: relative;
  z-index: 2;
}

/* ============================================
   Intro Text
   ============================================ */

.score-popup__intro {
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.6;
  width: 100%;
  max-width: 720px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

/* ============================================
   Banner (Bottom Image)
   ============================================ */

.score-popup__banner {
  width: min(540px, 90%);
  max-width: 640px;
  margin: -20px auto 0;
  pointer-events: none;
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(120px) scale(0.94);
  position: relative;
  z-index: 2;
}

.score-popup__banner img {
  width: 100%;
  height: auto;
  display: block;
}

.score-popup__banner.is-animated {
  animation: scoreBannerPop 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes scoreBannerPop {
  0% {
    opacity: 0;
    transform: translateY(120px) scale(0.94);
  }
  70% {
    opacity: 1;
    transform: translateY(-6px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================
   Gravity Forms in popup – layout only
   Form field/button/label styles come from theme gravity-forms.css
   ============================================ */

#score-popup .score-popup__form-container {
  position: relative;
  z-index: 5;
  margin-top: clamp(20px, 3vw, 30px);
  flex-shrink: 0;
}

#score-popup .gform_wrapper,
#score-popup .gform_wrapper form,
#score-popup .gform_wrapper .gform_body,
#score-popup .gform_wrapper .gform_fields {
  position: relative;
  z-index: 5;
  background-color: #4cbcc1;
}

/* Remove Gravity Forms pseudo-element overlays in popup */
#score-popup .gform_wrapper::before,
#score-popup .gform_wrapper::after,
#score-popup .gform_wrapper form::before,
#score-popup .gform_wrapper form::after {
  content: none !important;
  display: none !important;
}

/* Remove borders/outlines from form container elements only (not inputs) */
#score-popup .gform_footer,
#score-popup .gform_page_footer,
#score-popup .gform_body,
#score-popup .gform_fields,
#score-popup .gfield,
#score-popup .ginput_container,
#score-popup .gform_wrapper,
#score-popup .gform_wrapper form {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Remove pseudo-element overlays from field elements */
#score-popup .gform_footer::before,
#score-popup .gform_footer::after,
#score-popup .gform_page_footer::before,
#score-popup .gform_page_footer::after,
#score-popup .gfield::before,
#score-popup .gfield::after,
#score-popup .gfield_label::after {
  border: none !important;
  box-shadow: none !important;
  background: none !important;
}

/* Remove 8-bit button shadow overlays in popup if they clash with frame */
#score-popup .btn-container::before,
#score-popup .btn-container::after {
  display: none !important;
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */

@media (max-width: 640px) {
  .score-popup {
    padding: 20px;
  }

  .score-popup__frame {
    padding: 15px;
    padding-bottom: 0;
  }

  .score-popup__content {
    padding: 24px 12px 32px;
  }

  .score-popup__header {
    min-height: 320px;
  }

  .score-popup__stars {
    height: 280px;
    transform: translate(-50%, -50%) scale(1.05);
  }

  .score-popup__banner {
    width: min(420px, 100%);
  }
}
