* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

#ar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* MindAR рендерит вложенный div + canvas + video — наши div-ы исключаем */
#ar-container > div:not(#loading):not(#no-targets-msg),
#ar-container canvas,
#ar-container video {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #fff;
  font-family: sans-serif;
  font-size: 16px;
  gap: 16px;
  z-index: 10;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#no-targets-msg {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-family: sans-serif;
  font-size: 15px;
  padding: 10px 20px;
  border-radius: 20px;
  z-index: 5;
  pointer-events: none;
}

/* Модальное окно */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal.hidden { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 32px;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
}

#modal-body {
  margin-top: 8px;
  font-family: sans-serif;
  line-height: 1.6;
  color: #222;
}

#modal-body img  { max-width: 100%; border-radius: 8px; margin: 8px 0; }
#modal-body video { max-width: 100%; border-radius: 8px; margin: 8px 0; }
#modal-body h1, #modal-body h2, #modal-body h3 { margin: 12px 0 6px; }
#modal-body p { margin-bottom: 8px; }
