/* ========== Reset & base ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #000;
  color: #fff;
  -webkit-font-smoothing: antialiased;
}

a-scene {
  width: 100% !important;
  height: 100% !important;
}

/* ========== HUD Overlay ========== */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

#hud-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  pointer-events: none;
}

#app-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: center;
  opacity: 0.9;
}

/* Status badge */
.badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.3s ease;
}

.badge.badge-loading {
  background: rgba(255, 183, 0, 0.25);
}

.badge.badge-ready {
  background: rgba(76, 175, 80, 0.3);
}

.badge.badge-tracking {
  background: rgba(33, 150, 243, 0.3);
}

.badge.badge-error {
  background: rgba(244, 67, 54, 0.3);
}

/* Error message */
.error {
  max-width: 300px;
  text-align: center;
  font-size: 13px;
  color: #f88;
  padding: 8px 12px;
  background: rgba(244, 67, 54, 0.15);
  border-radius: 8px;
  line-height: 1.4;
}

.error.hidden {
  display: none;
}

/* ========== Hint overlay ========== */
#hint-overlay {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 30px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  animation: hint-fade-in 2s ease 2s forwards;
  transition: opacity 0.4s ease;
}

#hint-overlay.hidden {
  opacity: 0 !important;
}

#hint-text {
  font-size: 14px;
  text-align: center;
  white-space: nowrap;
}

@keyframes hint-fade-in {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* ========== Restart camera button ========== */
.restart-btn {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  padding: 10px 20px;
  border: none;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.restart-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.restart-btn:active {
  transform: translateX(-50%) scale(0.96);
}

/* ========== Loading overlay ========== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 200;
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  display: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#nft-loading-text {
  font-size: 15px;
  opacity: 0.9;
}

/* ========== Spinner ========== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.small {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.spinner.large {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

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

/* ========== Video fade transitions ========== */
/* A-Frame component handles opacity via animation, but we
   use CSS classes for any additional transitions if needed. */

/* ========== Mobile responsive ========== */
@media (max-width: 480px) {
  #app-title {
    font-size: 16px;
  }

  #hint-overlay {
    bottom: 80px;
    padding: 10px 18px;
  }

  #hint-text {
    font-size: 13px;
    white-space: nowrap;
  }

  .restart-btn {
    bottom: 20px;
    padding: 8px 16px;
    font-size: 12px;
  }

  .badge {
    font-size: 12px;
    padding: 5px 12px;
  }

  .error {
    max-width: 260px;
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* Safe area for notched devices (iPhone X+) */
@supports (padding: max(0px)) {
  #hud-top {
    padding-top: max(16px, env(safe-area-inset-top));
  }

  .restart-btn {
    bottom: max(30px, env(safe-area-inset-bottom));
  }

  #hint-overlay {
    bottom: max(100px, env(safe-area-inset-bottom));
  }
}
