/* ================================================================
   Treasure Chest Gallery – Main Stylesheet
   ================================================================ */

:root {
  --tcg-gold:       #FFD700;
  --tcg-gold-deep:  #B8860B;
  --tcg-gem-red:    #FF3366;
  --tcg-gem-blue:   #3399FF;
  --tcg-cave:       #1a1a1a;
  --tcg-shadow:     rgba(0,0,0,.85);
  --tcg-radius:     12px;
  --tcg-transition: .35s cubic-bezier(.4,0,.2,1);
}

/* ── Wrapper ──────────────────────────────────────────────── */
.tcg-wrapper {
  position: relative;
  width:    100%;
  min-height: 300px;
  overflow: hidden;
  background: var(--tcg-cave);
  border-radius: var(--tcg-radius);
  box-shadow: inset 0 0 80px rgba(0,0,0,.9), 0 8px 40px rgba(0,0,0,.6);
  cursor: crosshair;
  user-select: none;
}

.tcg-canvas {
  display: block;
  width:   100% !important;
  height:  100% !important;
  outline: none;
  touch-action: none;
}

/* ── Hint UI ──────────────────────────────────────────────── */
.tcg-overlay-ui {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 10;
}

.tcg-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,215,0,.3);
  border-radius: 40px;
  padding: 8px 20px;
  color: rgba(255,215,0,.85);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: .85rem;
  letter-spacing: .04em;
  backdrop-filter: blur(6px);
  animation: tcg-hint-pulse 3s ease-in-out infinite;
  transition: opacity var(--tcg-transition);
}

.tcg-hint-icon { font-size: 1.1rem; }

.tcg-hint.tcg-hint-hidden { opacity: 0; }

@keyframes tcg-hint-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,215,0,.15); }
  50%      { box-shadow: 0 0 0 8px rgba(255,215,0,.0); }
}

/* ── Lightbox ─────────────────────────────────────────────── */
.tcg-lightbox {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--tcg-transition);
}

.tcg-lightbox[aria-hidden="false"] {
  opacity: 1;
  pointer-events: all;
}

.tcg-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5,3,2,.88);
  backdrop-filter: blur(8px);
}

.tcg-lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: min(90%, 880px);
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: tcg-lb-appear .45s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes tcg-lb-appear {
  from { transform: scale(.7) translateY(40px); opacity: 0; }
  to   { transform: scale(1)  translateY(0);    opacity: 1; }
}

.tcg-lightbox[aria-hidden="true"] .tcg-lightbox-inner {
  animation: none;
}

.tcg-lightbox-img {
  max-width:  100%;
  max-height: 70vh;
  border-radius: var(--tcg-radius);
  box-shadow: 0 0 60px rgba(255,215,0,.25), 0 20px 60px rgba(0,0,0,.7);
  border: 2px solid rgba(255,215,0,.35);
  object-fit: contain;
}

.tcg-lightbox-caption {
  color: rgba(255,215,0,.9);
  font-family: Georgia, serif;
  font-size: 1rem;
  letter-spacing: .06em;
  text-shadow: 0 2px 12px rgba(0,0,0,.9);
  margin: 0;
  text-align: center;
}

.tcg-lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255,215,0,.12);
  border: 1px solid rgba(255,215,0,.4);
  border-radius: 50%;
  width: 36px; height: 36px;
  color: var(--tcg-gold);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--tcg-transition), transform var(--tcg-transition);
}
.tcg-lightbox-close:hover {
  background: rgba(255,215,0,.3);
  transform: rotate(90deg);
}

/* Navigation arrows */
.tcg-lightbox-nav {
  display: flex;
  gap: 24px;
}

.tcg-lightbox-nav button {
  background: rgba(255,215,0,.1);
  border: 1px solid rgba(255,215,0,.35);
  border-radius: 50%;
  width: 48px; height: 48px;
  color: var(--tcg-gold);
  font-size: 1.6rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--tcg-transition), transform var(--tcg-transition);
}
.tcg-lightbox-nav button:hover {
  background: rgba(255,215,0,.25);
  transform: scale(1.1);
}

/* ── CSS Particle Bursts ──────────────────────────────────── */
.tcg-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.tcg-particle {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tcg-gold);
  pointer-events: none;
  animation: tcg-particle-fly var(--dur, .9s) ease-out forwards;
  transform-origin: center;
}

@keyframes tcg-particle-fly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx,0), var(--ty,-80px)) scale(.2); opacity: 0; }
}

/* ── Loading Spinner ──────────────────────────────────────── */
.tcg-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 5;
}

.tcg-loading-ring {
  width: 48px; height: 48px;
  border: 3px solid rgba(255,215,0,.15);
  border-top-color: var(--tcg-gold);
  border-radius: 50%;
  animation: tcg-spin 1s linear infinite;
}

@keyframes tcg-spin { to { transform: rotate(360deg); } }

.tcg-loading-text {
  color: rgba(255,215,0,.6);
  font-family: Georgia, serif;
  font-size: .85rem;
  letter-spacing: .1em;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .tcg-hint { font-size: .75rem; padding: 6px 14px; }
  .tcg-lightbox-img { max-height: 60vh; }
  .tcg-lightbox-nav button { width: 40px; height: 40px; font-size: 1.3rem; }
}

@media (max-width: 480px) {
  .tcg-wrapper { border-radius: 8px; }
  .tcg-lightbox-inner { max-width: 96%; }
  .tcg-lightbox-close { top: -40px; right: -4px; }
}
