/* ─── Roulette Page ─────────────────────────────────────────────────────────── */

.roulette-header {
  text-align: center;
  padding: 40px 0 32px;
}
.roulette-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.roulette-sub {
  color: var(--text-muted);
  font-size: 1rem;
}

/* ─── Grid caisses ───────────────────────────────────────────────────────────── */
.caisses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding-bottom: 60px;
}
.caisse-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  text-decoration: none;
  display: block;
}
.caisse-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(192,57,43,.25);
}
.caisse-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #1a2030;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}
.caisse-card-img img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}
.caisse-card-body {
  padding: 16px;
}
.caisse-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.caisse-card-desc {
  color: var(--text-muted);
  font-size: .85rem;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.caisse-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.caisse-card-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}
.caisse-card-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.caisse-card-btn:hover { background: #a93226; }

/* ─── Page ouverture ─────────────────────────────────────────────────────────── */
.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9rem;
  padding: 20px 0 16px;
  transition: color .2s;
}
.back-link:hover { color: var(--accent); }

.caisse-open-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 0 28px;
}
.caisse-open-header img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--border);
}
.caisse-open-header h2 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.caisse-open-header p {
  color: var(--text-muted);
  margin: 0;
}

/* ─── Piste roulette ─────────────────────────────────────────────────────────── */
.roulette-track-wrap {
  position: relative;
  margin: 0 0 28px;
}
.roulette-pointer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  background: var(--accent);
  z-index: 10;
  box-shadow: 0 0 12px rgba(192,57,43,.8);
  pointer-events: none;
}
.roulette-pointer::before,
.roulette-pointer::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
}
.roulette-pointer::before {
  top: -1px;
  border-top: 12px solid var(--accent);
}
.roulette-pointer::after {
  bottom: -1px;
  border-bottom: 12px solid var(--accent);
}
.roulette-track-outer {
  overflow: hidden;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #0a0f16;
}
.roulette-track {
  display: flex;
  gap: 6px;
  padding: 6px;
  will-change: transform;
  transition: none;
}
.roulette-track.spinning {
  transition: transform 6s cubic-bezier(0.12, 0.8, 0.2, 1);
}

/* ─── Item de roulette ───────────────────────────────────────────────────────── */
.roulette-item {
  flex: 0 0 120px;
  height: 130px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  transition: border-color .3s;
}
.roulette-item.winner {
  border-color: var(--accent) !important;
  box-shadow: 0 0 24px rgba(192,57,43,.6);
}
.roulette-item img {
  position: absolute;
  top: 0; left: 0; right: 0;
  width: 100%;
  height: 90px;
  object-fit: cover;
  opacity: .9;
}
.roulette-item-emoji {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-60%);
  font-size: 2.5rem;
}
.roulette-item-name {
  position: relative;
  z-index: 2;
  font-size: .7rem;
  font-weight: 600;
  color: #fff;
  text-align: center;
  padding: 4px 4px 6px;
  background: rgba(0,0,0,.65);
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Rarity borders */
.roulette-item.commun        { border-color: #7f8c8d; }
.roulette-item.peu-commun    { border-color: #27ae60; }
.roulette-item.rare          { border-color: #2980b9; }
.roulette-item.epique        { border-color: #8e44ad; }
.roulette-item.legendaire    { border-color: #f39c12; }

/* ─── Actions ────────────────────────────────────────────────────────────────── */
.roulette-actions {
  text-align: center;
  margin-bottom: 32px;
}
.btn-open {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 36px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .15s;
  text-decoration: none;
  max-width: 380px;
  width: 100%;
  justify-content: center;
}
.btn-open:hover:not(:disabled) { background: #a93226; transform: translateY(-2px); }
.btn-open:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-open-price {
  background: rgba(0,0,0,.2);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: .9rem;
}
.roulette-hint {
  color: var(--text-muted);
  font-size: .85rem;
  margin: 10px 0 0;
}

/* ─── Résultat ───────────────────────────────────────────────────────────────── */
.roulette-result {
  text-align: center;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 32px;
  animation: fadeIn .4s ease;
}
.result-label {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}
.result-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 28px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #0a0f16;
  min-width: 180px;
}
.result-card img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
}
.result-card-emoji { font-size: 4rem; }
.result-card-name {
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}
.result-card-rarity {
  font-size: .8rem;
  font-weight: 600;
  text-transform: capitalize;
  padding: 3px 10px;
  border-radius: 12px;
}
.rarity-commun     { background: rgba(127,140,141,.2); color: #95a5a6; }
.rarity-peu-commun { background: rgba(39,174,96,.2);   color: #2ecc71; }
.rarity-rare       { background: rgba(41,128,185,.2);  color: #3498db; }
.rarity-epique     { background: rgba(142,68,173,.2);  color: #9b59b6; }
.rarity-legendaire { background: rgba(243,156,18,.2);  color: #f1c40f; }

/* ─── Contenu possible ───────────────────────────────────────────────────────── */
.caisse-items-section {
  padding-bottom: 60px;
}
.caisse-items-section h3 {
  font-size: 1.2rem;
  color: var(--text);
  margin: 0 0 20px;
  font-weight: 700;
}
.caisse-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.caisse-item-card {
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  text-align: center;
  transition: transform .2s;
}
.caisse-item-card:hover { transform: translateY(-2px); }
.caisse-item-card.commun     { border-color: #7f8c8d; }
.caisse-item-card.peu-commun { border-color: #27ae60; }
.caisse-item-card.rare       { border-color: #2980b9; }
.caisse-item-card.epique     { border-color: #8e44ad; }
.caisse-item-card.legendaire { border-color: #f39c12; }
.caisse-item-img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  background: #0a0f16;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.caisse-item-img img {
  width: 100%;
  height: 90px;
  object-fit: cover;
}
.caisse-item-body {
  padding: 8px;
}
.caisse-item-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.caisse-item-rarity {
  font-size: .7rem;
  text-transform: capitalize;
  color: var(--text-muted);
}
.caisse-item-pct {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Animations ─────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes glow-winner {
  0%,100% { box-shadow: 0 0 12px var(--accent); }
  50%      { box-shadow: 0 0 32px var(--accent), 0 0 60px rgba(192,57,43,.4); }
}
.result-card.legendary-glow {
  animation: glow-winner 1.6s ease-in-out infinite;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  width: 100%;
  grid-column: 1/-1;
}

/* ─── Ticker live ────────────────────────────────────────────────────────────── */
.live-ticker-wrap {
  background: rgba(10,15,22,.9);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  height: 48px;
  position: relative;
  z-index: 5;
}
.live-ticker-label {
  flex: 0 0 auto;
  padding: 0 16px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(192,57,43,.12);
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  letter-spacing: .04em;
}
.live-ticker-outer {
  flex: 1;
  overflow: hidden;
  height: 100%;
  position: relative;
  mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
}
.live-ticker-track {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  white-space: nowrap;
  animation: ticker-scroll 40s linear infinite;
}
.live-ticker-track:hover { animation-play-state: paused; }
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 8px;
  height: 36px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  flex: 0 0 auto;
  cursor: default;
  transition: border-color .2s;
}
.ticker-item:hover { border-color: var(--accent); }
.ticker-item.legendaire { border-color: rgba(243,156,18,.5); background: rgba(243,156,18,.06); }
.ticker-item.epique     { border-color: rgba(142,68,173,.5);  background: rgba(142,68,173,.06); }
.ticker-item.rare       { border-color: rgba(41,128,185,.5);  background: rgba(41,128,185,.06); }
.ticker-item img.ticker-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.ticker-username {
  font-size: .78rem;
  color: var(--text-muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ticker-sep {
  color: var(--border);
  font-size: .7rem;
}
.ticker-item-img {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 4px;
  background: #0a0f16;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.ticker-item-img img {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 4px;
}
.ticker-item-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ticker-rarity {
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  text-transform: capitalize;
}

/* ─── Historique table ───────────────────────────────────────────────────────── */
.historique-section {
  padding-bottom: 60px;
}
.historique-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.historique-header h3 {
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 700;
  margin: 0;
}
.historique-refresh-label {
  font-size: .78rem;
  color: var(--text-muted);
}
.historique-table {
  width: 100%;
  border-collapse: collapse;
}
.historique-table th {
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.historique-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
  font-size: .88rem;
}
.historique-table tr:hover td {
  background: rgba(255,255,255,.02);
}
.historique-table tr.new-entry td {
  animation: fadeInRow .5s ease;
}
@keyframes fadeInRow {
  from { background: rgba(192,57,43,.12); }
  to   { background: transparent; }
}
.histo-player {
  display: flex;
  align-items: center;
  gap: 10px;
}
.histo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #1a2030;
}
.histo-username {
  font-weight: 600;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.histo-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.histo-item-img {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  background: #0a0f16;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.histo-item-img img {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
}
.histo-item-name {
  font-weight: 600;
  color: var(--text);
}
.histo-rarity {
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  text-transform: capitalize;
  white-space: nowrap;
}
.histo-time {
  color: var(--text-muted);
  font-size: .8rem;
  white-space: nowrap;
}
.historique-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  font-size: .9rem;
}

@media (max-width: 640px) {
  .historique-table th:nth-child(3),
  .historique-table td:nth-child(3) { display: none; }
  .live-ticker-label { display: none; }
}
