/* Reset & Core Design System */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-dark: #070709;
  --surface-glass: rgba(255, 255, 255, 0.04);
  --surface-glass-border: rgba(255, 255, 255, 0.09);
  --surface-glass-hover: rgba(255, 255, 255, 0.07);
  --text-main: #f5f5f7;
  --text-muted: #86868b;
  --text-sub: #a1a1a6;
  --accent-cyan: #38bdf8;
  --accent-gold: #fbbf24;
  --accent-purple: #c084fc;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Ambient Glow & Canvas */
#ambientCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
}

.bg-glow {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(192, 132, 252, 0.06) 45%, transparent 70%);
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  z-index: 100;
  background: rgba(7, 7, 9, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--surface-glass-border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-symbol {
  font-size: 1.2rem;
  color: var(--accent-cyan);
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
}

.brand-text {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  color: var(--text-main);
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--surface-glass);
  border: 1px solid var(--surface-glass-border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Main Layout */
.main-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 60px 20px;
}

.hero-content {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Pill Badge */
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 6px 16px;
  border-radius: 30px;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.pill-icon {
  font-size: 0.85rem;
}

/* Typography */
.main-title {
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: #ffffff;
}

.gradient-text {
  background: linear-gradient(135deg, #ffffff 30%, var(--accent-cyan) 70%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 400;
  color: var(--text-sub);
  max-width: 580px;
  line-height: 1.5;
  margin-bottom: 40px;
}

/* 3D Lootbox Element */
.lootbox-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin-top: 36px;
  margin-bottom: 56px;
  perspective: 800px;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.lootbox-aura {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, rgba(251, 191, 36, 0.15) 50%, transparent 75%);
  filter: blur(20px);
  animation: aura-pulse 3s infinite ease-in-out;
}

@keyframes aura-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

.lootbox {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(-18deg) rotateY(25deg);
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: rotateX(-18deg) rotateY(25deg) translateY(0px); }
  50% { transform: rotateX(-14deg) rotateY(35deg) translateY(-14px); }
}

.box-face {
  position: absolute;
  width: 140px;
  height: 140px;
  background: rgba(18, 18, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.6s ease;
}

.box-front  { transform: rotateY(0deg) translateZ(70px); }
.box-back   { transform: rotateY(180deg) translateZ(70px); }
.box-right  { transform: rotateY(90deg) translateZ(70px); }
.box-left   { transform: rotateY(-90deg) translateZ(70px); }
.box-top    { transform: rotateX(90deg) translateZ(70px); }
.box-bottom { transform: rotateX(-90deg) translateZ(70px); }

.box-symbol {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent-cyan);
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.8);
  font-family: var(--font-family);
}

.energy-core {
  position: absolute;
  top: 30px;
  left: 30px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #38bdf8 0%, #fbbf24 60%, transparent 100%);
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.5;
  transform: translateZ(0);
  animation: core-pulse 2s infinite ease-in-out;
}

@keyframes core-pulse {
  0%, 100% { opacity: 0.4; scale: 0.9; }
  50% { opacity: 0.8; scale: 1.1; }
}

/* Unboxing Reveal Animation Trigger Classes */
.lootbox-wrapper.is-unboxing {
  animation: unboxing-shake 0.8s ease-in-out forwards;
}

.lootbox-wrapper.is-unboxing .box-top {
  transform: rotateX(175deg) translateZ(70px);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes unboxing-shake {
  0% { transform: scale(1) rotate(0deg); }
  20% { transform: scale(1.1) rotate(-8deg); }
  40% { transform: scale(1.2) rotate(8deg); }
  60% { transform: scale(1.3) rotate(-5deg); }
  80% { transform: scale(1.4) rotate(5deg); }
  100% { transform: scale(1.6) rotate(0deg); opacity: 0; }
}

/* Countdown Grid */
.countdown-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.countdown-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.time-card {
  min-width: 100px;
  padding: 20px 16px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--surface-glass-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.time-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.time-card.highlight {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.04);
}

.time-val {
  font-family: var(--font-mono);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.time-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.time-divider {
  font-size: 2rem;
  font-weight: 300;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: -16px;
}

.target-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.target-info strong {
  color: var(--text-sub);
}

/* Reveal Container & Video Frame */
.reveal-container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 24px;
  animation: reveal-fade-in 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes reveal-fade-in {
  0% { opacity: 0; transform: scale(0.92) translateY(30px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.unlocked-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  padding: 8px 20px;
  border-radius: 30px;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
  margin: 0 auto;
}

.video-frame-wrapper {
  position: relative;
  width: 100%;
  margin: 0 auto;
  border-radius: 24px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
}

.video-frame-glow {
  position: absolute;
  inset: -1px;
  border-radius: 25px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.4), rgba(251, 191, 36, 0.3), rgba(192, 132, 252, 0.4));
  z-index: -1;
  filter: blur(15px);
  opacity: 0.5;
}

.video-aspect-ratio {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  border-radius: 16px;
  overflow: hidden;
  background: #000000;
  margin: 0 auto;
}

.video-aspect-ratio iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Thumbnail Card & Play Button Overlay */
.thumbnail-link {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  overflow: hidden;
  border-radius: 16px;
  cursor: pointer;
}

.thumbnail-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.6s ease;
}

.thumbnail-link:hover .thumbnail-img {
  transform: scale(1.04);
  filter: brightness(1.08);
}

.play-button-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.7) 100%);
  transition: background 0.3s ease;
}

.thumbnail-link:hover .play-button-overlay {
  background: radial-gradient(circle, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 100%);
}

.play-icon-glass {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  padding-left: 2px; /* Perfect visual balance for triangle icon */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.2);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  margin: 0 auto;
}

.thumbnail-link:hover .play-icon-glass {
  transform: scale(1.14);
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 15px 40px rgba(56, 189, 248, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.4);
}

.play-label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #ffffff;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.thumbnail-link:hover .play-label {
  background: rgba(56, 189, 248, 0.25);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

/* Footer */
.app-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 30px 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--surface-glass-border);
}

/* Debug Floating Panel */
.debug-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(18, 18, 24, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.debug-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
}

.debug-btn {
  padding: 8px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent-cyan);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.debug-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.03);
}

.debug-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-sub);
}

.debug-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Utility Helpers */
.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .countdown-grid {
    gap: 8px;
  }
  .time-card {
    min-width: 70px;
    padding: 14px 8px;
  }
  .time-val {
    font-size: 1.8rem;
  }
  .time-divider {
    font-size: 1.4rem;
    margin-top: -10px;
  }
  .main-title {
    font-size: 2.2rem;
  }
  .debug-panel {
    bottom: 12px;
    right: 12px;
    left: 12px;
    justify-content: center;
    flex-wrap: wrap;
  }
}
