* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* MindAR appends its video and canvases here. fixed + z-index:0 makes a stacking
   context, so the library's video (z-index:-2) stays inside it. */
#container {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

/* MindAR's built-in loading/scanning overlays are absolute with z-index:2, so the
   panel sits above them and Start/Stop stay tappable. */
#panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px;
  background: rgba(0, 0, 0, 0.6);
}

h1 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
}

.row {
  display: flex;
  gap: 8px;
}

button {
  flex: 1;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  color: #000;
  background: #fff;
}

button:disabled {
  opacity: 0.35;
}

#stopBtn {
  background: #ffb4a8;
}

#status {
  margin: 8px 0 0;
  font-size: 0.95rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#status .label {
  opacity: 0.7;
}

#statusDetail {
  display: block;
  margin-top: 2px;
  font-size: 0.85rem;
}

#status[data-state="target found"] #statusState {
  color: #6dff9c;
}

#status[data-state="target lost"] #statusState {
  color: #ffd166;
}

#status[data-state="error"] #statusState,
#status[data-state="error"] #statusDetail {
  color: #ff7b7b;
}

#debug {
  margin-top: 8px;
  font-size: 0.85rem;
}

#debug summary {
  min-height: 32px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

#log {
  margin: 4px 0 0;
  max-height: 38vh;
  overflow: auto;
  padding: 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.75);
  font: 0.72rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
