/* Self-hosted Minecraft UI font (OFL-1.1, see apoie/fonts/OFL.txt) - used only
   for currency digits, since Pixelify Sans draws 0 like O and 5 like S,
   which friends of the project owner couldn't read. */
@font-face {
  font-family: "Minecraft";
  src: url("fonts/Minecraft.otf") format("opentype");
  font-weight: 400;
}

@font-face {
  font-family: "Minecraft";
  src: url("fonts/Minecraft-Bold.otf") format("opentype");
  font-weight: 700;
}

/* home's body is a fixed-size card with overflow hidden; this page's card
   grows with the donation count, so the page itself needs to scroll once
   it's taller than the viewport (overriding home's rules, loaded first) */
body {
  align-items: flex-start;
  overflow-y: auto;
  padding: 2.5rem 0;
}

.apoie-card {
  width: min(480px, 90vw);
  max-width: 480px;
  text-align: center;
}

.apoie-intro {
  margin: 0;
  color: var(--purple-dark);
  font-size: 0.95rem;
  line-height: 1.5;
}

.pixgg-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-family: "Pixelify Sans", monospace;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--cream-soft);
  background: var(--purple-dark);
  border: 3px solid var(--purple-deep);
  box-shadow: 4px 4px 0 var(--purple-deep);
}

.pixgg-button:hover {
  background: var(--purple);
}

.pixgg-button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--purple-deep);
}

.progress-wrap {
  width: 100%;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  /* extra room reserved for the fallen-books decoration sitting on top
     of the bar, so it doesn't collide with this text */
  margin-bottom: 1.6rem;
  font-size: 0.95rem;
  color: var(--purple-dark);
}

#progress-current,
.progress-goal,
.feed-item-amount,
.achievement-hint {
  font-family: "Minecraft", monospace;
  font-weight: 700;
}

#progress-current {
  font-size: 1.15rem;
}

.progress-goal {
  font-size: 1rem;
  opacity: 0.75;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 1.5rem;
  background: var(--cream);
  border: 3px solid var(--purple-dark);
  overflow: visible;
}

/* a little pile of tumbled books resting on top of the bar's right edge
   (left end already has the achievement lock/trophy) - doubles as the
   button that opens the "Livraria Drowsy" minigame */
.fallen-books {
  position: absolute;
  right: 4px;
  bottom: calc(100% + 2px);
  width: 34px;
  height: 22px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.fallen-books svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fallen-books:hover {
  transform: translateY(-2px) scale(1.08);
}

.fallen-books:active {
  transform: translateY(0) scale(0.96);
}

/* Fullscreen minigame popup */
.minigame-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(16, 9, 26, 0.92);
}

.minigame-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

.minigame-close {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 201;
  width: 2.5rem;
  height: 2.5rem;
  font-family: "Pixelify Sans", monospace;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--cream-soft);
  background: var(--purple-dark);
  border: 3px solid var(--purple-deep);
  box-shadow: 3px 3px 0 var(--purple-deep);
  cursor: pointer;
}

.minigame-close:hover {
  background: var(--purple);
}

.minigame-close:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--purple-deep);
}

.achievement-hint {
  display: table;
  margin: 0.5rem auto 0;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  color: #5a3d00;
  background: #f6d860;
  border: 2px solid #a8790c;
  animation: hint-blink 3s ease-in-out infinite;
}

.achievement-hint.hidden {
  display: none;
}

/* the badge itself never fades out of legibility - only its glow pulses,
   so the "too pale to read" problem from a pure text-opacity blink can't
   happen at either end of the animation */
@keyframes hint-blink {
  0%,
  100% {
    background: #fce9a8;
    box-shadow: none;
  }
  50% {
    background: #f6d860;
    box-shadow: 0 0 8px rgba(246, 216, 96, 0.9);
  }
}

@media (prefers-reduced-motion: reduce) {
  .achievement-hint {
    animation: none;
  }
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--purple);
  transition: width 0.6s ease-out;
  overflow: hidden;
}

.achievement-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: var(--cream-soft);
  border: 2px solid var(--purple-dark);
  border-radius: 50%;
  cursor: default;
  padding: 0;
  line-height: 1;
}

.achievement-marker.unlocked {
  cursor: default;
  background: #f6d860;
  border-color: #a8790c;
  animation: marker-pulse 1.8s ease-in-out infinite;
}

@keyframes marker-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(246, 216, 96, 0.6);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(246, 216, 96, 0);
  }
}

.feed-wrap {
  width: 100%;
}

.feed-title {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--purple-dark);
  text-align: left;
}

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 3px solid var(--purple-dark);
  background: var(--cream);
}

.feed-item {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 2px solid var(--cream-soft);
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--purple-deep);
}

.feed-item-name {
  font-weight: 700;
}

.feed-item-amount {
  white-space: nowrap;
}

.feed-item-message {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--purple-dark);
}

.feed-item-time {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  opacity: 0.6;
}

.feed-empty {
  padding: 1rem 0.8rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--purple-dark);
  opacity: 0.7;
}

.back-link {
  color: var(--purple-dark);
  font-size: 0.9rem;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* Achievement unlock banner */
.achievement-banner {
  position: fixed;
  z-index: 100;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  width: min(360px, 85vw);
  padding: 1.5rem 1rem;
  text-align: center;
  background: linear-gradient(180deg, #fff3c4, #f6d860);
  border: 4px solid #a8790c;
  box-shadow: 6px 6px 0 var(--purple-deep);
  opacity: 0;
  pointer-events: none;
}

.achievement-banner.show {
  animation: banner-pop 2.6s ease-out forwards;
}

@keyframes banner-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
  20% {
    transform: translate(-50%, -50%) scale(1);
  }
  85% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
}

.achievement-banner-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #5a3d00;
}

.achievement-banner-sub {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  font-family: "Minecraft", monospace;
  font-weight: 700;
  color: #7a5a12;
}
