:root {
  --bg: #150f22;
  --panel: #1e1730;
  --text: #f3efe8;
  --muted: #b7add0;
  --accent: #caa3ff;
  --danger: #ff8a80;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
body {
  /* Safari/WebKit has a known bug where MindAR's negative-z-index video
     element fails to composite behind a fixed-position sibling unless
     the parent has its own explicit stacking context. */
  position: relative;
  z-index: 0;
}
a-scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 24px;
  text-align: center;
  background: var(--bg);
  z-index: 20;
}
.screen[hidden] { display: none !important; }
.screen h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}
.screen p {
  margin: 0;
  max-width: 32em;
  line-height: 1.5;
  color: var(--muted);
  font-size: 1rem;
}
.note {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 26em;
}
button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--accent);
  color: #1a1226;
  cursor: pointer;
}
button:active { transform: scale(0.98); }
button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.25);
}
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#scanning-hint {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  z-index: 15;
  background: rgba(21, 15, 34, 0.72);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}
#scanning-hint .sub {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}
#scanning-hint[hidden] { display: none; }

#debug-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  background: #000;
  color: #7CFC00;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 10px;
  white-space: pre;
  max-width: 60vw;
}
#debug-panel button {
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
}

#tune-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 50;
  width: 260px;
  background: rgba(10, 7, 18, 0.92);
  color: var(--text);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  padding: 10px;
  overflow-y: auto;
  pointer-events: auto;
}
#tune-panel h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 14px 0 6px;
}
#tune-panel h2:first-child { margin-top: 0; }
#tune-panel label {
  display: block;
  margin-top: 8px;
}
#tune-panel input[type="range"] {
  width: 100%;
}
#tune-panel pre {
  background: #000;
  color: #7CFC00;
  padding: 6px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 10px;
  margin-top: 6px;
}
