html,
body {
  overflow: hidden;
}

#ar-container {
  width: 100%;
  height: 100%;
  /* MindAR positions its <video>/<canvas> children with position:absolute
     (video specifically at z-index:-2, camera behind the 3D overlay canvas).
     Without an explicit positioned ancestor here, that stacking can resolve
     unpredictably across browsers/devices instead of nesting cleanly inside
     this container. */
  position: relative;
  z-index: 1;
}

/* Deliberately NOT styling #ar-container video here. MindAR computes its
   own cover-fit width/height/offset for the <video> element internally
   (to correctly crop+center the camera feed for the container's aspect
   ratio) and applies that via inline style — forcing width/height:100%
   here fights that calculation and was causing the video to render
   shifted/cropped on real devices. The canvas is sized explicitly in JS
   instead (see main.js), matching the known-working Jabot3D/webAR.html
   reference, which also leaves the video element untouched. */

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 14px 16px calc(10px + env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, var(--color-scrim), transparent);
  color: var(--color-text);
  pointer-events: none;
}

#hud h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#mission-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--color-scrim), transparent);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

#mission-tiles {
  display: flex;
  gap: 10px;
}

.mission-tile {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  opacity: 0.35;
  filter: grayscale(70%);
  transition: opacity 0.25s, filter 0.25s, border-color 0.25s, transform 0.25s;
}

.mission-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mission-tile-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1px 0;
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}

.mission-tile-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-success);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  transform: scale(0);
  transition: transform 0.2s ease-out;
}

.mission-tile.found {
  opacity: 1;
  filter: none;
  border-color: var(--color-success);
  transform: translateY(-2px);
}

.mission-tile.found .mission-tile-badge {
  transform: scale(1);
}

#mission-reset-btn {
  align-self: center;
  padding: 4px 6px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
  pointer-events: auto;
}

#mission-complete-banner {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 16px;
  right: 16px;
  z-index: 15;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-success);
  background: var(--color-success-bg);
  color: var(--color-success);
  font-size: 13px;
  font-weight: 600;
}

#mission-complete-banner.visible {
  display: flex;
}

#mission-complete-close {
  padding: 0 4px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--color-bg);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 16px;
}

#start-overlay h1 {
  font-size: 20px;
  margin: 0;
}

#start-overlay p {
  max-width: 320px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0;
}

#start-overlay button {
  margin-top: 8px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-accent-text);
  cursor: pointer;
}

#start-overlay.hidden {
  display: none;
}

#error-banner {
  position: fixed;
  top: 50%;
  left: 16px;
  right: 16px;
  transform: translateY(-50%);
  z-index: 30;
  background: var(--color-error-bg);
  color: var(--color-error-text);
  padding: 16px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}
