/* Core palette and typography */
:root {
  --pink: #FA2F6A;
  --light: #F5F5F5;
  --text-dark: #262626;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--light);
  background: linear-gradient(to bottom, #FFE8EE, #FE9EBA);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("assets/kenrick-mills-MF9Wy1NA55I-unsplash.jpg")
    center/cover no-repeat fixed;
  opacity: 0.8;
  pointer-events: none;
  z-index: -1;
}

/* Layout */
.wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 32px;
}

#welcome-screen {
  transform: translateY(-100px);
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.screen.active {
  display: flex;
}

/* Top bar with Rules + year */
.top-header {
  position: fixed;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 200px);
  max-width: 1200px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  z-index: 20;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--pink);
}

.rules-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--pink);
  cursor: pointer;
  font: inherit;
}

.rules-btn:focus-visible {
  outline: 2px solid var(--light);
  outline-offset: 3px;
}

.header-year {
  color: var(--pink);
}

/* Titles & text */
.welcome-title,
.game-title {
  margin: 2px 0 12px;
  font-family: "Monsieur La Doulaise", cursive;
  font-weight: 400;
  color: var(--pink);
}

.welcome-title {
  /* ~186px on desktop */
  font-size: 11.625rem;
}

.game-title {
  /* ~128px on desktop */
  font-size: 8rem;
}

.welcome-subtitle,
.question-label,
.inbetween-text,
.end-title {
  margin: 4px 0 0;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--light);
}

.question-label {
  margin-top: 8px;
  position: relative;
  top: -100px;
}

/* Hearts & imagery */
.welcome-heart,
.heart-progress,
.heart-full {
  margin-top: 32px;
  max-width: 160px;
  width: 28vw;
}

/* Buttons */
.btn {
  margin-top: 28px;
  padding: 14px 40px;
  min-width: 160px;
  border-radius: 999px;
  border: none;
  background-color: var(--pink);
  color: var(--light);
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.14s ease, background-color 0.14s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--light);
  outline-offset: 3px;
}

.btn-start {
  margin-top: 12px;
}

.btn-next {
  margin-top: 18px;
  position: relative;
  top: -100px;
}

/* Question card */
.card {
  margin-top: 18px;
  background-color: rgba(245, 245, 245, 0.96);
  border-radius: 999px;
  padding: 26px 40px;
  max-width: 760px;
  width: 100%;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
  position: relative;
  top: -100px;
}

#question {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.5;
  color: var(--pink);
  font-style: italic;
}

.fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Level names row */
.level-names {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.level-names span[data-level] {
  font-weight: 700;
  color: rgba(245, 245, 245, 0.75);
}

.level-names .sep {
  color: rgba(245, 245, 245, 0.45);
}

/* Screen-specific positioning */
#question-screen .game-title {
  position: relative;
  top: -100px;
}

#welcome-screen .welcome-subtitle {
  position: relative;
  top: -30px;
}

#question-screen .level-names {
  position: relative;
  top: -70px;
}

#inbetween-screen .game-title {
  position: relative;
  top: -100px;
}

#inbetween-screen .inbetween-text {
  position: relative;
  top: -100px;
}

#inbetween-screen .heart-progress {
  position: relative;
  top: -100px;
}

#inbetween-screen #continue-btn {
  position: relative;
  top: -100px;
}

#inbetween-screen .level-names {
  position: relative;
  top: -70px;
}

/* Popups (rules + special tasks) */
.popup-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.popup-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.popup {
  position: relative;
  max-width: 520px;
  width: 90%;
  padding: 28px 28px 26px;
  border-radius: 30px;
  background-color: var(--pink);
  color: var(--light);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.5);
  text-align: left;
}

.popup-title {
  margin: 0 0 12px;
  font-size: 1.6rem;
}

.popup-list {
  margin: 0;
  padding-left: 1.2rem;
  line-height: 1.6;
}

.popup-desc {
  margin: 4px 0 0;
  line-height: 1.6;
}

.popup-heart {
  display: block;
  margin: 20px auto 4px;
  max-width: 120px;
}

/* Heart animation */
@keyframes heartPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.05);
  }
}

.heart-progress,
.heart-full,
.popup-heart {
  animation: heartPulse 2.3s ease-in-out infinite;
}

.popup-x {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.popup-x img {
  width: 18px;
  height: 18px;
}

/* End screen tweaks */
#end-screen .heart-full {
  margin-top: 80px;
  max-width: 180px;
}

#end-screen .end-title {
  margin-top: 32px;
}

#end-screen .heart-full,
#end-screen .end-title,
#end-screen #play-again-btn {
  position: relative;
  top: -65px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .top-header {
    width: calc(100% - 40px);
    top: 18px;
    font-size: 0.75rem;
  }

  .welcome-title,
  .game-title {
    margin-top: 10px;
    font-size: clamp(3.2rem, 11vw, 4.6rem);
  }

  .card {
    border-radius: 32px;
    padding: 22px 18px;
  }

  #question {
    font-size: 1.05rem;
  }

  .level-names {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .popup {
    padding-inline: 22px;
  }
}
