html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
}

a-scene { display: block; width: 100vw; height: 100vh; position: relative; }

/* MindAR appends <video> as sibling of a-scene inside <body>. It sets z-index:-2 inline,
   which makes it invisible behind body background. Override + size to cover viewport. */
body > video {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  object-fit: cover !important;
  z-index: 0 !important;
  display: block !important;
}
a-scene .a-canvas { z-index: 1 !important; background: transparent !important; }

/* === DEBUG mode: bật bằng URL ?debug — outline cháy mọi element + nhãn === */
body.debug { background: magenta !important; }
body.debug > * { outline: 4px solid lime !important; outline-offset: -4px; position: relative; }
body.debug a-scene { outline-color: red !important; background: rgba(255,0,0,0.15) !important; }
body.debug a-scene .a-canvas { outline: 4px dashed cyan !important; outline-offset: -8px; background: rgba(0,255,255,0.15) !important; }
body.debug > video { outline: 4px solid orange !important; outline-offset: -4px; }
body.debug #intro { outline-color: blue !important; background: rgba(0,0,255,0.5) !important; }
body.debug #progressOverlay { outline-color: yellow !important; background: rgba(255,255,0,0.3) !important; }
body.debug *::before {
  content: attr(id) " " attr(class) " z=" var(--zhint, "?");
  position: absolute; top: 2px; left: 2px;
  font: bold 11px ui-monospace, monospace;
  color: white; background: black;
  padding: 2px 4px; z-index: 9999;
  pointer-events: none;
}
body.debug a-scene::before { content: "a-scene"; }
body.debug > video::before { content: "video (mindar) — bigger than canvas means video shows"; }

#intro, #endScreen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #2d1b3e 0%, #1a1226 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  box-sizing: border-box;
}

#endScreen { display: none; }

.card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 30px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(8px);
}

.card h1, .card h2 {
  font-family: 'Luckiest Guy', cursive;
  letter-spacing: 1px;
  margin: 0 0 12px;
  color: #ffd23f;
}

.card h1 { font-size: 28px; }
.card h2 { font-size: 36px; color: #00e08a; }

.card p {
  margin: 8px 0 16px;
  font-size: 15px;
  line-height: 1.4;
  color: rgba(255,255,255,0.85);
}

.preview {
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 12px auto;
  display: block;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
}

button {
  background: #ffd23f;
  color: #1a1226;
  border: none;
  padding: 14px 32px;
  border-radius: 100px;
  font-family: 'Luckiest Guy', cursive;
  font-size: 18px;
  letter-spacing: 1px;
  cursor: pointer;
  margin: 12px 0 8px;
  transition: transform 0.1s;
}

button:active { transform: scale(0.96); }

.hint {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-top: 12px;
}

#itemsPanel {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 50;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  max-width: 80px;
}
#itemsPanel.visible { display: flex; }
#itemsPanel .items-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.9);
  text-align: center;
  margin-bottom: 2px;
}
#itemsPanel .item {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  transition: opacity 0.3s, background 0.3s;
}
#itemsPanel .item img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  filter: grayscale(0.3) brightness(0.7);
  transition: filter 0.4s;
}
#itemsPanel .item .check {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  background: #00e08a;
  color: #001;
  border-radius: 50%;
  font-weight: 900;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.25s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid #fff;
}
#itemsPanel .item.found img {
  filter: grayscale(0) brightness(1);
}
#itemsPanel .item.found {
  background: rgba(0,224,138,0.18);
  box-shadow: 0 0 18px rgba(0,224,138,0.4);
}
#itemsPanel .item.found .check {
  opacity: 1;
  transform: scale(1);
}

#progressOverlay {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: none;
  text-align: center;
}

#progressOverlay.visible { display: block; }

.progress-pill {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 10px 20px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 16px;
  display: inline-block;
}

#hintText {
  margin-top: 10px;
  background: rgba(0,0,0,0.4);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  display: inline-block;
}

#foundList {
  list-style: none;
  padding: 0;
  text-align: left;
  display: inline-block;
}

#foundList li {
  padding: 4px 0;
  font-size: 15px;
}

#foundList li::before {
  content: "✓ ";
  color: #00e08a;
  font-weight: 700;
}
