* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Georgia, "Times New Roman", serif;
  color: #3f2417;
}

body {
  position: relative;
  background: url("../images/vieuxpapier.jpg") center center / cover no-repeat fixed;
}

.page-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 248, 238, 0.72);
  z-index: 0;
}

.topbar,
.recompenses-main {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 22px 24px 0;
  flex-wrap: wrap;
}

.retour-site {
  text-decoration: none;
  color: #5b241b;
  font-weight: bold;
  font-size: 1rem;
  background: rgba(255, 250, 245, 0.88);
  border: 1px solid rgba(110, 70, 45, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 6px 16px rgba(65, 25, 18, 0.10);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.retour-site:hover {
  background: rgba(255, 250, 245, 0.97);
  box-shadow: 0 8px 18px rgba(65, 25, 18, 0.15);
}

.ressources {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ressource-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 78px;
  padding: 7px 11px;
  border-radius: 14px;
  background: rgba(255, 250, 245, 0.88);
  border: 1px solid rgba(110, 70, 45, 0.24);
  box-shadow: 0 6px 16px rgba(65, 25, 18, 0.08);
}

.ressource-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
}

.piece-icon {
  width: 27px;
  height: 27px;
}

.ressource-value {
  font-size: 0.98rem;
  font-weight: bold;
  color: #611f16;
  line-height: 1;
}

.tooltip-box {
  position: relative;
  cursor: help;
}

.tooltip-box::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 250, 245, 0.97);
  color: #5b241b;
  font-size: 0.9rem;
  font-weight: normal;
  line-height: 1.3;
  border: 1px solid rgba(110, 70, 45, 0.22);
  box-shadow: 0 10px 24px rgba(65, 25, 18, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 30;
}

.tooltip-box:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.recompenses-main {
  padding: 18px 40px 60px;
}

.recompenses-main h1 {
  text-align: center;
  margin: 12px 0 28px;
  font-size: clamp(2.2rem, 5vw, 4rem);
  color: #5b241b;
  text-shadow: 1px 1px 0 rgba(255, 250, 245, 0.7);
}

.reward-section {
  margin: 0 auto 38px;
  max-width: 1450px;
}

.reward-section h2 {
  text-align: center;
  margin: 0 0 18px;
  font-size: 1.8rem;
  color: #6a2a1f;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}


.avatar-card,
.deco-card,
.crown-card {
  background: rgba(255, 250, 245, 0.72);
  border: 1px solid rgba(110, 70, 45, 0.18);
  border-radius: 22px;
  box-shadow: 0 8px 18px rgba(65, 25, 18, 0.08);
  padding: 14px;
  text-align: center;
}

.avatar-card.selected,
.deco-card.selected,
.crown-card.selected {
  outline: 3px solid rgba(164, 98, 49, 0.45);
}

.avatar-card.locked-soft,
.deco-card.locked-soft {
  opacity: 0.52;
  filter: grayscale(0.65);
}

.avatar-frame,
.deco-frame,
.crown-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(221, 214, 205, 0.94) 0%, rgba(192, 181, 167, 0.94) 100%);
  padding: 5px;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.40),
    0 6px 14px rgba(60, 30, 18, 0.10);
  margin-bottom: 12px;
}

.avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: rgba(245, 239, 231, 0.96);
  object-fit: cover;
  object-position: center 18%;
  display: block;
}

.deco-frame,
.crown-frame {
  display: flex;
  align-items: center;
  justify-content: center;
}

.deco-image {
  width: 88%;
  height: 88%;
  object-fit: contain;
  display: block;
}

.crown-image {
  width: 92%;
  height: 92%;
  object-fit: contain;
  display: block;
}

.emblem-fit {
  object-fit: contain;
  object-position: center center;
  padding: 6px;
}

.avatar-name {
  font-size: 1.08rem;
  font-weight: bold;
  color: #5b241b;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-price {
  font-size: 0.95rem;
  color: #7a2a1d;
  margin-bottom: 10px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.avatar-btn {
  border: none;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: bold;
  color: #fffaf7;
  background: linear-gradient(180deg, #8d3026 0%, #6f2119 100%);
  box-shadow: 0 6px 14px rgba(65, 25, 18, 0.14);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.avatar-btn:hover:not(:disabled) {
  filter: brightness(1.04);
}

.avatar-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.avatar-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.select-btn.is-selected {
  background: linear-gradient(180deg, #7f6642 0%, #695434 100%);
}

.progress-btn {
  background: linear-gradient(180deg, #7d7467 0%, #62584d 100%);
}

.deco-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.crowns-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crown-card.locked {
  background: rgba(72, 62, 56, 0.18);
  color: #f5f2ed;
}

.crown-title {
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 6px;
}

.crown-title-light {
  color: #5b241b;
}

.crown-card.locked .crown-title-light {
  color: #f5f2ed;
}

@media (max-width: 1300px) {
  .reward-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .deco-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1050px) {
  .reward-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .deco-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .crowns-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .ressources {
    justify-content: flex-start;
  }

  .recompenses-main {
    padding: 18px 20px 50px;
  }

  .reward-grid,
  .deco-grid,
  .crowns-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .reward-grid,
  .deco-grid,
  .crowns-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .avatar-card,
  .deco-card,
  .crown-card {
    padding: 8px;
    border-radius: 14px;
  }

  .avatar-name {
    font-size: 0.8rem;
    min-height: 30px;
    line-height: 1.1;
  }

  .avatar-price {
    font-size: 0.72rem;
    min-height: 24px;
    margin-bottom: 6px;
  }

  .avatar-btn {
    width: 100%;
    font-size: 0.72rem;
    padding: 7px 4px;
    border-radius: 10px;
  }
}

.avatar-name {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-name {
  line-height: 1.1;
}


.reward-card.affordable-soft,
.avatar-card.affordable-soft,
.deco-card.affordable-soft {
  opacity: 1 !important;
  filter: none !important;
}

.locked-soft.affordable-soft .avatar-frame,
.locked-soft.affordable-soft .deco-frame {
  filter: grayscale(0.15);
  opacity: 1;
}

.locked-soft.affordable-soft .avatar-image,
.locked-soft.affordable-soft .deco-image {
  filter: none;
  opacity: 1;
}

.locked-soft.affordable-soft {
  background: rgba(255, 250, 245, 0.88);
  border-color: rgba(122, 42, 29, 0.22);
}
