/* ══════════════════════════════════════════════════════════════════════════
   CHESTS.CSS — Treasure Chest Animation & Icon System
   Rise Family Quest
   ══════════════════════════════════════════════════════════════════════════ */

/* ── RARITY GLOW COLORS ── */
.chest-rarity-common    { --chest-glow: #C0C0C0; --chest-glow-dim: rgba(192,192,192,0.35); }
.chest-rarity-rare      { --chest-glow: #4AAED9; --chest-glow-dim: rgba(74,174,217,0.35); }
.chest-rarity-epic      { --chest-glow: #9B59B6; --chest-glow-dim: rgba(155,89,182,0.35); }
.chest-rarity-legendary { --chest-glow: #E9A825; --chest-glow-dim: rgba(233,168,37,0.35); }

/* ══════════════════════════════════════════════════════════════════════════
   CHEST UNLOCK OVERLAY
   ══════════════════════════════════════════════════════════════════════════ */

.chest-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px 20px;
  box-sizing: border-box;
  animation: overlay-fade-in 0.35s ease-out forwards;
}

.chest-overlay--exit {
  animation: overlay-fade-out 0.35s ease-in forwards;
}

@keyframes overlay-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes overlay-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Headline above chest */
.chest-headline {
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted, #7A90B8);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 24px;
  text-align: center;
}

/* ── CHEST STAGE (centered column) ── */
.chest-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 280px;
}

/* ── STAR ROW ── */
.chest-stars {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
  height: 36px;
}

.chest-star {
  font-size: 28px;
  opacity: 0;
  transform: scale(0) rotate(-20deg);
  transition: none;
  filter: drop-shadow(0 0 8px var(--chest-glow, #E9A825));
}

.chest-star--visible {
  animation: star-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes star-pop {
  0%   { opacity: 0; transform: scale(0) rotate(-20deg); }
  70%  { opacity: 1; transform: scale(1.2) rotate(5deg); }
  100% { opacity: 1; transform: scale(1.0) rotate(0deg); }
}

/* ── CHEST CONTAINER ── */
.chest-container {
  position: relative;
  width: 160px;
  height: 140px;
  perspective: 600px;
  flex-shrink: 0;
}

/* ── GLOW RING ── */
.chest-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--chest-glow-dim, rgba(233,168,37,0.35)) 0%, transparent 70%);
  box-shadow: 0 0 32px 12px var(--chest-glow-dim, rgba(233,168,37,0.3));
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.3s;
}

.chest-glow--pulsing {
  opacity: 1;
  animation: glow-pulse 1.8s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%   { transform: translate(-50%, -50%) scale(1.0);  box-shadow: 0 0 32px 12px var(--chest-glow-dim); }
  50%  { transform: translate(-50%, -50%) scale(1.25); box-shadow: 0 0 60px 24px var(--chest-glow-dim); }
  100% { transform: translate(-50%, -50%) scale(1.0);  box-shadow: 0 0 32px 12px var(--chest-glow-dim); }
}

/* ── CHEST ART ── */
.chest-art {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Chest body (bottom portion) */
.chest-body {
  width: 120px;
  height: 70px;
  background: linear-gradient(160deg, #7C4A1A 0%, #5C3410 50%, #3A1E08 100%);
  border: 3px solid #A0622A;
  border-radius: 6px 6px 10px 10px;
  position: relative;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,200,100,0.2),
    0 0 0 1px rgba(160,98,42,0.5);
  z-index: 2;
}

/* Metal band across the chest body */
.chest-body::after {
  content: '';
  position: absolute;
  top: 50%;
  left: -3px; right: -3px;
  height: 14px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #B87333 0%, #8B5820 50%, #B87333 100%);
  border-top: 1px solid #D4954A;
  border-bottom: 1px solid #D4954A;
}

/* Lock clasp on chest body */
.chest-clasp {
  position: absolute;
  width: 20px;
  height: 22px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  background: linear-gradient(180deg, #E9A825 0%, #C07820 100%);
  border: 2px solid #FFD700;
  border-radius: 4px;
  box-shadow: 0 0 8px var(--chest-glow, #E9A825);
}

/* Chest lid */
.chest-lid {
  width: 124px;
  height: 44px;
  background: linear-gradient(160deg, #9A5C22 0%, #7C4214 50%, #5C2E0A 100%);
  border: 3px solid #A0622A;
  border-radius: 6px 6px 2px 2px;
  position: relative;
  top: 4px;
  transform-origin: center bottom;
  transform-style: preserve-3d;
  box-shadow:
    0 -3px 12px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,200,100,0.2);
  z-index: 3;
  transition: none;
}

/* Metal band on lid */
.chest-lid::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: -3px; right: -3px;
  height: 10px;
  background: linear-gradient(180deg, #B87333 0%, #8B5820 50%, #B87333 100%);
  border-top: 1px solid #D4954A;
  border-bottom: 1px solid #D4954A;
}

.chest-lid--shaking {
  animation: lid-shake 0.6s linear forwards;
}

@keyframes lid-shake {
  0%   { transform: rotate(0deg) translateX(0); }
  15%  { transform: rotate(4deg) translateX(3px); }
  30%  { transform: rotate(-4deg) translateX(-3px); }
  50%  { transform: rotate(3deg) translateX(2px); }
  70%  { transform: rotate(-3deg) translateX(-2px); }
  85%  { transform: rotate(1deg) translateX(1px); }
  100% { transform: rotate(0deg) translateX(0); }
}

.chest-lid--open {
  animation: chest-open 0.4s ease-out forwards;
}

@keyframes chest-open {
  0%   { transform: rotateX(0deg) translateY(0px); }
  100% { transform: rotateX(-130deg) translateY(-10px); }
}

/* ── LIGHT BURST ── */
.chest-burst {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 0; height: 0;
  pointer-events: none;
  z-index: 4;
}

.chest-burst--active .chest-ray {
  animation: ray-burst 0.5s ease-out forwards;
}

.chest-ray {
  position: absolute;
  width: 3px;
  height: 60px;
  background: linear-gradient(to top, var(--chest-glow, #E9A825), transparent);
  transform-origin: center bottom;
  opacity: 0;
  top: -60px;
  left: -1.5px;
}

@keyframes ray-burst {
  0%   { transform: rotate(var(--ray-angle)) scaleY(0); opacity: 1; }
  60%  { transform: rotate(var(--ray-angle)) scaleY(1); opacity: 0.8; }
  100% { transform: rotate(var(--ray-angle)) scaleY(1.1); opacity: 0; }
}

/* ── RARITY LABEL ── */
.chest-rarity-label {
  font-family: 'Lexend', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  margin-top: 14px;
}

.chest-rarity-label--common    { color: #C0C0C0; background: rgba(192,192,192,0.15); border: 1px solid rgba(192,192,192,0.3); }
.chest-rarity-label--rare      { color: #4AAED9; background: rgba(74,174,217,0.15);  border: 1px solid rgba(74,174,217,0.3); }
.chest-rarity-label--epic      { color: #B07FCC; background: rgba(155,89,182,0.15);  border: 1px solid rgba(155,89,182,0.3); }
.chest-rarity-label--legendary { color: #E9A825; background: rgba(233,168,37,0.15);  border: 1px solid rgba(233,168,37,0.3); }

/* ── CHEST NAME ── */
.chest-name {
  font-family: 'Lexend', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text, #EEF0F8);
  text-align: center;
  margin-top: 8px;
  text-shadow: 0 0 20px var(--chest-glow, #E9A825);
}

/* ── REWARD REVEAL ── */
.chest-reward-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: none;
  text-align: center;
  width: 100%;
  margin-top: 16px;
}

.chest-reward-reveal--visible {
  animation: reward-rise 0.5s ease-out forwards;
}

@keyframes reward-rise {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

.chest-reward-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.chest-reward-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 14px;
}

.chest-reward-icon {
  font-size: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 0 4px rgba(255,220,100,0.6));
}
.chest-reward-icon svg { display: block; }
.chest-reward-text { font-family: 'Lexend', sans-serif; font-size: 14px; font-weight: 600; color: var(--text, #EEF0F8); }

/* ── CONTINUE BUTTON ── */
.chest-continue-btn {
  width: 280px;
  padding: 14px;
  background: linear-gradient(135deg, var(--blue-dark, #1A6FA8), var(--blue, #4AAED9));
  border: none;
  border-radius: 14px;
  color: white;
  font-family: 'Lexend', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 20px;
  opacity: 0;
  transform: translateY(10px);
  box-shadow: 0 4px 20px rgba(74,174,217,0.4);
  letter-spacing: 0.3px;
}

.chest-continue-btn--visible {
  animation: btn-appear 0.3s ease-out forwards, btn-pulse 1.5s ease-in-out 0.3s infinite;
}

@keyframes btn-appear {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes btn-pulse {
  0%, 100% { transform: scale(1.0); }
  50%       { transform: scale(1.03); }
}

/* ── PARTICLE ── */
@keyframes particle-fly {
  0%   { transform: translate(-50%, -50%) translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   CHEST ICONS (on Rise Road and Arena Map screens)
   ══════════════════════════════════════════════════════════════════════════ */

.chest-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  user-select: none;
  /* Rarity glow color fallback — overridden by rarity classes below */
  --chest-glow: #E9A825;
}

.chest-icon__art {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: filter 0.25s, opacity 0.25s, transform 0.25s;
}
.chest-icon__art svg { display: block; }

/* Soft base halo behind ALL chest states — keeps the silhouette readable */
.chest-icon::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 12px;
  background: radial-gradient(closest-side, var(--chest-glow) 0%, transparent 72%);
  opacity: 0.18;
  filter: blur(6px);
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 0;
}
.chest-icon > * { position: relative; z-index: 1; }

/* Locked state — still visible and premium, just restrained.
   Keeps color identity instead of going fully grayscale. */
.chest-icon--locked .chest-icon__art {
  opacity: 0.72;
  filter: saturate(0.55) brightness(0.82) drop-shadow(0 0 3px rgba(8,14,24,0.6));
}
.chest-icon--locked::before {
  opacity: 0.1;
  background: radial-gradient(closest-side, rgba(140,160,200,0.7) 0%, transparent 70%);
}

.chest-icon__lock {
  position: absolute;
  bottom: -3px;
  right: -3px;
  background: var(--card, #1F2E4A);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border, #2E4070);
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
  z-index: 2;
}
.chest-icon__lock svg { display: block; }

/* Pending (unlocked, ready to open) — rarity glow + subtle lift */
.chest-icon--pending .chest-icon__art {
  filter:
    drop-shadow(0 0 4px rgba(255,255,255,0.35))
    drop-shadow(0 0 9px var(--chest-glow, #E9A825))
    drop-shadow(0 0 16px var(--chest-glow, #E9A825));
}
.chest-icon--pending::before { opacity: 0.55; }
.chest-icon--pending:hover .chest-icon__art { transform: translateY(-1px) scale(1.04); }

.chest-icon__pulse-ring {
  position: absolute;
  inset: -5px;
  border-radius: 14px;
  border: 2px solid var(--chest-glow, #E9A825);
  animation: icon-pulse-ring 1.6s ease-out infinite;
  pointer-events: none;
  z-index: 1;
}

/* Shimmer sweep overlay on pending chests (subtle, GPU-cheap) */
.chest-icon__shimmer {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}
.chest-icon__shimmer::after {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 45%; height: 100%;
  background: linear-gradient(100deg,
    transparent 30%,
    rgba(255,255,255,0.22) 50%,
    transparent 70%);
  transform: skewX(-18deg);
  animation: chest-shimmer 3.4s ease-in-out infinite;
}
@keyframes chest-shimmer {
  0%, 60%  { left: -60%; }
  100%     { left: 130%; }
}

@keyframes icon-pulse-ring {
  0%   { transform: scale(0.9); opacity: 0.9; }
  100% { transform: scale(1.42); opacity: 0; }
}

/* Opened state — clearly done but not dead */
.chest-icon--opened .chest-icon__art {
  opacity: 0.55;
  filter: saturate(0.7) brightness(0.9);
}
.chest-icon--opened::before { opacity: 0.1; }

/* Rarity-colored borders on pending chests */
.chest-icon--pending.chest-icon--common    { --chest-glow: #C8D0DE; }
.chest-icon--pending.chest-icon--rare      { --chest-glow: #4AAED9; }
.chest-icon--pending.chest-icon--epic      { --chest-glow: #B060EE; }
.chest-icon--pending.chest-icon--legendary { --chest-glow: #F5C030; }
/* Locked rarity tint (softer) */
.chest-icon--locked.chest-icon--common    { --chest-glow: #C8D0DE; }
.chest-icon--locked.chest-icon--rare      { --chest-glow: #4AAED9; }
.chest-icon--locked.chest-icon--epic      { --chest-glow: #B060EE; }
.chest-icon--locked.chest-icon--legendary { --chest-glow: #F5C030; }

/* Tooltip */
.chest-icon__tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card, #1F2E4A);
  border: 1px solid var(--border, #2E4070);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: 'Lexend', sans-serif;
  font-size: 10px;
  color: var(--muted, #7A90B8);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.chest-icon:hover .chest-icon__tooltip {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════════════════════════
   CHEST EDIT MODAL (Admin)
   ══════════════════════════════════════════════════════════════════════════ */

.chest-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
}

.chest-edit-modal__sheet {
  background: var(--card, #1F2E4A);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px 36px;
  width: 100%;
  max-width: 430px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  animation: sheet-slide-up 0.3s ease-out forwards;
}

@keyframes sheet-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.chest-edit-modal__title {
  font-family: 'Lexend', sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: var(--text, #EEF0F8);
  margin-bottom: 20px;
}

.chest-form-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted, #7A90B8);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.chest-form-input,
.chest-form-select {
  width: 100%;
  background: var(--bg, #0F1117);
  border: 1.5px solid var(--border, #2E4070);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text, #EEF0F8);
  font-family: 'Lexend', sans-serif;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 14px;
  appearance: none;
  -webkit-appearance: none;
}

.chest-form-input:focus,
.chest-form-select:focus {
  border-color: var(--blue, #4AAED9);
}

.chest-form-row {
  display: flex;
  gap: 10px;
}

.chest-form-row .chest-form-input,
.chest-form-row .chest-form-select {
  flex: 1;
}

/* ── Reward rows section ── */
.chest-form-rewards-header {
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #7A90B8);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
  margin-top: 4px;
}

.chest-form-add-reward-btn {
  width: 100%;
  padding: 10px;
  background: rgba(74,174,217,0.08);
  border: 1.5px dashed rgba(74,174,217,0.35);
  border-radius: 10px;
  color: var(--blue, #4AAED9);
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  margin-bottom: 14px;
}

.chest-form-save-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--blue-dark, #1A6FA8), var(--blue, #4AAED9));
  border: none;
  border-radius: 13px;
  color: white;
  font-family: 'Lexend', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 10px;
  box-shadow: 0 4px 16px rgba(74,174,217,0.35);
}

.chest-form-cancel-btn {
  width: 100%;
  padding: 12px;
  background: none;
  border: 1.5px solid var(--border, #2E4070);
  border-radius: 12px;
  color: var(--muted, #7A90B8);
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════════════════════
   TOPBAR CHEST NOTIFICATION BADGE
   ══════════════════════════════════════════════════════════════════════════ */

.topbar-chest-badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(233, 168, 37, 0.12);
  border: 1.5px solid rgba(233, 168, 37, 0.45);
  border-radius: 20px;
  padding: 4px 9px;
  cursor: pointer;
  font-family: 'Lexend', sans-serif;
  animation: badge-glow-pulse 2s ease-in-out infinite;
  outline: none;
}

@keyframes badge-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233,168,37,0); border-color: rgba(233,168,37,0.45); }
  50%       { box-shadow: 0 0 12px 3px rgba(233,168,37,0.28); border-color: rgba(233,168,37,0.8); }
}

.topbar-chest-badge__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.topbar-chest-badge__icon svg { display: block; }

.topbar-chest-badge__count {
  font-family: 'Lexend', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #E9A825;
  line-height: 1;
  min-width: 10px;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════════════════
   DASHBOARD PENDING CHEST BANNER
   ══════════════════════════════════════════════════════════════════════════ */

.pending-chest-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(233,168,37,0.08) 0%, rgba(233,168,37,0.04) 100%);
  border: 1.5px solid rgba(233, 168, 37, 0.35);
  border-radius: 16px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  animation: banner-shimmer-in 0.5s ease-out forwards;
}

@keyframes banner-shimmer-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pending-chest-banner:hover {
  border-color: rgba(233,168,37,0.65);
  background: linear-gradient(135deg, rgba(233,168,37,0.14) 0%, rgba(233,168,37,0.07) 100%);
}

.pending-chest-banner__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(233,168,37,0.5));
  animation: banner-icon-bounce 2.4s ease-in-out infinite;
}
.pending-chest-banner__icon svg { display: block; }

@keyframes banner-icon-bounce {
  0%, 100% { transform: translateY(0); }
  45%       { transform: translateY(-3px); }
  65%       { transform: translateY(-1px); }
}

.pending-chest-banner__text {
  flex: 1;
  min-width: 0;
}

.pending-chest-banner__title {
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #E9A825;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pending-chest-banner__sub {
  font-family: 'Lexend', sans-serif;
  font-size: 11px;
  color: var(--muted, #7A90B8);
  line-height: 1.4;
}

.pending-chest-banner__arrow {
  font-size: 16px;
  color: rgba(233,168,37,0.6);
  flex-shrink: 0;
  font-weight: 700;
  transition: transform 0.2s;
}
.pending-chest-banner:hover .pending-chest-banner__arrow {
  transform: translateX(2px);
}

/* ══════════════════════════════════════════════════════════════════════════
   CHEST ICON — NEW / UNREVEALED STATE (stacked on --pending)
   ══════════════════════════════════════════════════════════════════════════ */

/* "NEW" pill badge rendered via ::after on the icon wrapper */
.chest-icon--new::after {
  content: 'READY';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #E9A825, #FFB830);
  color: #0A0A0A;
  font-family: 'Lexend', sans-serif;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.5px;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 1px 6px rgba(233,168,37,0.5);
}

/* Stronger glow for new chests vs plain pending */
.chest-icon--new .chest-icon__art {
  filter:
    drop-shadow(0 0 4px rgba(255,255,255,0.45))
    drop-shadow(0 0 10px var(--chest-glow, #E9A825))
    drop-shadow(0 0 22px var(--chest-glow, #E9A825));
}
.chest-icon--new::before { opacity: 0.7; }

/* Bounce animation for unrevealed chests on Road */
.chest-icon--new .chest-icon__art {
  animation: new-chest-bounce 2.2s ease-in-out infinite;
}

@keyframes new-chest-bounce {
  0%, 100% { transform: translateY(0) scale(1.00); }
  40%       { transform: translateY(-3px) scale(1.03); }
  60%       { transform: translateY(-1px) scale(1.01); }
}

/* ══════════════════════════════════════════════════════════════════════════
   CHEST ANNOUNCE OVERLAY (first-time unlock celebration)
   ══════════════════════════════════════════════════════════════════════════ */

.chest-announce-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.94);
  padding: 24px 20px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.chest-announce-overlay.chest-announce--visible {
  opacity: 1;
  pointer-events: auto;
}

.chest-announce-overlay.chest-announce--exit {
  opacity: 0;
  pointer-events: none;
}

/* Rarity-tinted background glow */
.chest-announce--common    { --ca-glow: #C0C0C0; --ca-glow-dim: rgba(192,192,192,0.12); }
.chest-announce--rare      { --ca-glow: #4AAED9; --ca-glow-dim: rgba(74,174,217,0.14); }
.chest-announce--epic      { --ca-glow: #B060EE; --ca-glow-dim: rgba(176,96,238,0.14); }
.chest-announce--legendary { --ca-glow: #E9A825; --ca-glow-dim: rgba(233,168,37,0.14); }

.chest-announce-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, var(--ca-glow-dim, rgba(233,168,37,0.12)) 0%, transparent 65%);
  pointer-events: none;
}

.chest-announce-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  max-width: 300px;
  width: 100%;
}

/* Floating sparkle particles around the chest icon */
.chest-announce-sparkles {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.chest-announce-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ca-glow, #E9A825);
  opacity: 0;
  /* Orbit distance from center */
  --orbit: 110px;
  transform:
    rotate(var(--sa, 0deg))
    translateY(calc(-1 * var(--orbit)))
    scale(var(--sz, 1));
  animation: sparkle-float 3s ease-in-out var(--sd, 0s) infinite;
  box-shadow: 0 0 6px var(--ca-glow, #E9A825);
}

@keyframes sparkle-float {
  0%, 100% { opacity: 0; transform: rotate(var(--sa)) translateY(calc(-1 * var(--orbit))) scale(var(--sz)); }
  20%       { opacity: 0.9; }
  50%       { opacity: 0.6; transform: rotate(calc(var(--sa) + 18deg)) translateY(calc(-1 * var(--orbit) - 12px)) scale(calc(var(--sz) * 1.15)); }
  80%       { opacity: 0.3; }
}

.chest-announce-kicker {
  font-family: 'Lexend', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ca-glow, #E9A825);
  margin-bottom: 10px;
  opacity: 0;
  animation: announce-rise 0.5s ease-out 0.1s forwards;
}

.chest-announce-title {
  font-family: 'Lexend', sans-serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--text, #EEF0F8);
  line-height: 1.15;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
  text-shadow: 0 0 32px var(--ca-glow, #E9A825);
  opacity: 0;
  animation: announce-rise 0.5s ease-out 0.2s forwards;
}

.chest-announce-subtitle {
  font-family: 'Lexend', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #7A90B8);
  margin-bottom: 28px;
  min-height: 18px;
  opacity: 0;
  animation: announce-rise 0.5s ease-out 0.3s forwards;
}

.chest-announce-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  filter: drop-shadow(0 0 16px var(--ca-glow, #E9A825))
          drop-shadow(0 0 40px var(--ca-glow-dim, rgba(233,168,37,0.4)));
  opacity: 0;
  animation: announce-chest-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.4) 0.35s forwards;
}
.chest-announce-icon-wrap svg { display: block; }

@keyframes announce-chest-pop {
  0%   { opacity: 0; transform: scale(0.4) rotate(-8deg); }
  70%  { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.chest-announce-open-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #B87008, #E9A825 50%, #FFD700);
  border: none;
  border-radius: 14px;
  color: #0A0800;
  font-family: 'Lexend', sans-serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.2px;
  cursor: pointer;
  margin-bottom: 12px;
  box-shadow: 0 4px 24px rgba(233,168,37,0.45);
  opacity: 0;
  transform: translateY(10px);
  animation: announce-rise 0.4s ease-out 0.7s forwards;
  transition: transform 0.15s, box-shadow 0.15s;
}
.chest-announce-open-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(233,168,37,0.6);
}
.chest-announce-open-btn:active { transform: scale(0.98); }

.chest-announce-later-btn {
  background: none;
  border: none;
  color: var(--muted, #7A90B8);
  font-family: 'Lexend', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
  opacity: 0;
  animation: announce-rise 0.4s ease-out 0.85s forwards;
  transition: color 0.15s;
}
.chest-announce-later-btn:hover { color: var(--text, #EEF0F8); }

@keyframes announce-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
