/* Boutique (coffres), ouverture de coffre et écran Équipement */

.shop-section {
  text-align: left;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #888;
  margin: 18px 0 8px;
}
.chest-list > .shop-section:first-child {
  margin-top: 0;
}

/* --- Récompenses (coffre gratuit, coffre bonus) --- */
.reward-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.chest-card {
  --chest: #00ccff;
}
.reward-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--chest) 45%, transparent);
  background: linear-gradient(120deg, color-mix(in srgb, var(--chest) 14%, transparent), rgba(0, 0, 0, 0.35));
  text-align: left;
}
.reward-icon {
  font-size: 30px;
  flex-shrink: 0;
  overflow: visible;
}
.reward-card .chest-info {
  flex: 1;
  min-width: 0;
}
.chest-info h4 {
  color: #fff;
  margin-bottom: 3px;
}
.chest-odds {
  font-size: 11px;
  color: #aaa;
}
.chest-card .shop-btn {
  flex-shrink: 0;
  min-width: 96px;
  padding: 10px 12px;
}
.chest-free.ready {
  box-shadow:
    0 0 15px rgba(0, 255, 136, 0.45),
    inset 0 0 20px rgba(0, 255, 136, 0.12);
  animation: freePulse 1.5s infinite;
}
.chest-free.ready .shop-btn {
  background: linear-gradient(180deg, #00ff88, #00aa55);
}
.chest-ad .shop-btn:not(:disabled) {
  background: linear-gradient(180deg, #ffe066, #ffaa00);
}

/* --- Coffres payants : tuiles --- */
.chest-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.chest-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}
.chest-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--chest) 50%, transparent);
  background: radial-gradient(
    circle at 50% 0,
    color-mix(in srgb, var(--chest) 22%, transparent),
    rgba(0, 0, 0, 0.4) 70%
  );
  text-align: center;
}
.chest-icon {
  font-size: 44px;
  overflow: visible;
  filter: drop-shadow(0 0 10px var(--chest));
}
.chest-tile h4 {
  color: #fff;
  font-size: 15px;
}
.chest-pool {
  font-size: 10px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.odds-bar {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 6px;
  margin-top: 4px;
  border-radius: 3px;
}
.odds-bar span {
  border-radius: 2px;
  box-shadow: 0 0 4px currentColor;
}
.odds-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 10px;
  min-height: 28px;
  font-size: 10px;
  color: #bbb;
}
.odds-chip::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--r);
  vertical-align: 0;
}
.chest-tile .shop-btn {
  width: 100%;
  margin-top: auto;
}

/* --- Ouverture --- */
#chestRevealContent {
  padding: 12px;
}
#chestReveal {
  border-color: #ffd700;
}
.chest-reveal {
  --rarity: #aaa;
  padding: 20px 10px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 2px solid var(--rarity);
  box-shadow:
    0 0 30px var(--rarity),
    inset 0 0 30px rgba(0, 0, 0, 0.6);
  animation: revealPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.rarity-glow-legendary {
  animation:
    revealPop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1),
    pulseGold 1.2s 0.5s infinite;
}
.reveal-icon {
  font-size: 64px;
  line-height: 1.2;
  overflow: visible;
}
.reveal-name {
  color: #fff;
  font-size: 22px;
  margin: 6px 0;
}
.reveal-stars,
.item-stars,
.slot-stars {
  color: #ffd700;
  letter-spacing: 2px;
}
.reveal-stats {
  color: #bbb;
  font-size: 12px;
  margin-top: 8px;
}
.reveal-result {
  color: #00ff88;
  font-weight: bold;
  margin-top: 12px;
}
.item-rarity {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}
@keyframes revealPop {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- Équipement : emplacements équipés --- */
.equipped-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
button.equipped-slot {
  --rarity: #444;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 100px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rarity) 70%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--rarity) 16%, transparent), rgba(0, 0, 0, 0.4));
  color: #fff;
  font-weight: 400;
}
button.equipped-slot.active {
  box-shadow:
    0 0 0 2px #00ccff,
    0 0 14px rgba(0, 204, 255, 0.4);
}
.slot-label {
  font-size: 10px;
  color: #888;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.slot-icon {
  font-size: 28px;
  overflow: visible;
}
.slot-name {
  font-size: 12px;
  font-weight: bold;
}
.slot-stars {
  font-size: 10px;
}
.slot-empty {
  color: #666;
  font-size: 12px;
}
.inv-tabs {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.inv-tabs .lb-tab {
  padding: 10px 4px;
  font-size: 12px;
}

/* --- Équipement : collection + fiche détaillée --- */
.inv-body {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 14px;
  align-items: start;
  text-align: left;
}
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  max-height: 44vh;
  overflow-y: auto;
  padding: 4px;
  touch-action: pan-y;
}
button.item-card {
  --rarity: #aaa;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px 10px;
  border-radius: 10px;
  border: 1px solid #333;
  border-bottom: 3px solid var(--rarity);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--rarity) 12%, transparent),
    rgba(0, 0, 0, 0.35)
  );
  color: #fff;
  font-weight: 400;
  overflow: visible;
}
button.item-card.selected {
  border-color: var(--rarity);
  box-shadow: 0 0 14px color-mix(in srgb, var(--rarity) 60%, transparent);
}
button.item-card.locked {
  opacity: 0.45;
}
.item-icon {
  font-size: 30px;
  overflow: visible;
}
.item-name {
  font-size: 12px;
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
}
.item-card .item-stars {
  font-size: 9px;
  letter-spacing: 1px;
}
.item-card.locked .item-stars {
  color: #888;
  letter-spacing: 0;
}
.item-level {
  font-size: 10px;
  color: #aaa;
}
.item-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #00ccff;
  color: #001018;
  font-size: 8px;
  font-weight: 900;
}
.item-up {
  position: absolute;
  top: 3px;
  right: 6px;
  color: #00ff88;
  font-size: 12px;
  text-shadow: 0 0 6px #00ff88;
}

.item-detail {
  --rarity: #aaa;
  position: sticky;
  top: 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--rarity) 55%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--rarity) 14%, transparent),
    rgba(0, 0, 0, 0.45)
  );
}
.detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.detail-icon {
  font-size: 46px;
  overflow: visible;
}
.detail-title h3 {
  color: #fff;
  font-size: 17px;
  margin-bottom: 2px;
}
.detail-progress {
  display: grid;
  gap: 4px;
  margin: 8px 0 10px;
  font-size: 12px;
  color: #ccc;
}
.copies-track {
  height: 6px;
  border-radius: 3px;
  background: #222;
}
.copies-track div {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #ffd700, #ffaa00);
}
.item-desc {
  font-size: 12px;
  color: #aaa;
}
.item-stats {
  font-size: 12px;
  color: #00ffff;
  margin-top: 6px;
}
.detail-locked {
  margin-top: 10px;
  font-size: 12px;
  color: #ff7aa8;
}
.item-actions {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}
.item-actions button {
  padding: 10px 6px;
  font-size: 12px;
}
.item-actions .level-btn:not(:disabled) {
  background: linear-gradient(180deg, #444, #222);
  color: #fff;
  border: 1px solid #ffd700;
}
.prestige-btn {
  background: linear-gradient(180deg, #ffd700, #aa7700);
}

/* --- Badge « coffre gratuit » sur l'accueil --- */
#btnShop {
  position: relative;
  overflow: visible;
}
#btnShop.has-free::after {
  content: "!";
  position: absolute;
  top: -9px;
  right: -7px;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  background: #00ff88;
  color: #002211;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 0 10px #00ff88;
  animation: bounceBadge 1s infinite;
}
@keyframes freePulse {
  50% {
    border-color: #aaffdd;
  }
}
@keyframes bounceBadge {
  50% {
    transform: translateY(-4px);
  }
}

/* --- Petits écrans --- */
@media (max-width: 760px), (max-height: 560px) {
  .reward-row {
    grid-template-columns: 1fr;
  }
  .chest-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .chest-grid.cols-3 > :last-child:nth-child(odd) {
    grid-column: span 2;
  }
  .chest-tile {
    padding: 12px 8px 10px;
  }
  .chest-icon {
    font-size: 34px;
  }
  .chest-tile h4 {
    font-size: 13px;
  }
  .reveal-icon {
    font-size: 48px;
  }
  .equipped-slots {
    gap: 6px;
    margin-bottom: 10px;
  }
  button.equipped-slot {
    min-height: 0;
    padding: 6px 4px;
  }
  .slot-icon {
    font-size: 22px;
  }
  .slot-name {
    font-size: 10px;
  }
  .slot-stars {
    display: none;
  }
  .inv-tabs .lb-tab {
    font-size: 10px;
    padding: 8px 2px;
  }
  .inv-body {
    grid-template-columns: 1fr;
  }
  .item-detail {
    order: -1; /* la fiche passe au-dessus de la grille */
    position: static;
  }
  .item-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    max-height: 34vh;
  }
  .item-actions {
    grid-template-columns: repeat(3, 1fr);
  }
  .item-actions button {
    font-size: 10px;
    padding: 9px 2px;
  }
}
@media (max-height: 560px) and (min-width: 761px) {
  .inv-body {
    grid-template-columns: 1fr 260px;
  }
  .item-detail {
    order: 0;
  }
  .item-grid {
    max-height: 52vh;
  }
}

/* Paysage : les menus larges gardent leur largeur (touch.css les limite à 500 px) */
@media (max-height: 560px) and (min-width: 761px) {
  .menu-overlay.menu-wide {
    max-width: 880px;
  }
}

/* Très petit écran (iPhone SE...) : cartes récompense plus compactes */
@media (max-width: 400px) {
  .reward-card {
    gap: 8px;
    padding: 10px;
  }
  .reward-icon {
    font-size: 22px;
  }
  .reward-card h4 {
    font-size: 13px;
  }
  .reward-card .shop-btn {
    min-width: 0;
    padding: 8px 10px;
    font-size: 12px;
  }
}
