/* ============ AnchorAR — shared styles ============ */
:root {
  --bg: #0b0d12;
  --bg-soft: #12151d;
  --panel: #171b26;
  --panel-2: #1e2333;
  --line: #2a3044;
  --text: #eef1f8;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent-2: #35d0ff;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --danger: #ff5c7a;
  --ok: #3ddc97;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(700px 400px at -10% 20%, rgba(53, 208, 255, 0.10), transparent 60%),
    var(--bg);
}

.hidden { display: none !important; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--panel-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--grad);
  border: none;
  color: #fff;
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.35);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 8px 26px rgba(124, 92, 255, 0.5); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel); }
.btn.danger { color: var(--danger); border-color: rgba(255, 92, 122, 0.35); }
.btn.xl { padding: 16px 40px; font-size: 17px; border-radius: 14px; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.chip.solid {
  color: #fff;
  border: none;
  background: var(--grad);
}
.chip.solid.alt { background: linear-gradient(135deg, #0aa2c9, #3ddc97); }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { font-size: 20px; letter-spacing: -0.01em; }
.brand p { font-size: 12.5px; color: var(--muted); }
.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 24px;
  border-radius: 12px;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.4);
}
.brand-mark.lg { width: 64px; height: 64px; font-size: 34px; border-radius: 18px; margin: 0 auto 4px; }
.topbar-actions { display: flex; gap: 10px; }

/* ---------- main / cards ---------- */
main { padding: 28px clamp(16px, 4vw, 48px); min-height: 60vh; }

.banner {
  background: rgba(255, 92, 122, 0.1);
  border: 1px solid rgba(255, 92, 122, 0.35);
  color: #ffb3c1;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 14px;
}

/* ---------- hero (empty state) ---------- */
.hero {
  text-align: center;
  padding: 56px 20px 72px;
  max-width: 860px;
  margin: 0 auto;
}
.hero-glyph {
  font-size: 54px;
  margin-bottom: 18px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero h2 { font-size: clamp(22px, 3.4vw, 32px); line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 14px; }
.hero-sub { color: var(--muted); font-size: 15px; line-height: 1.65; max-width: 560px; margin: 0 auto 40px; }
.hero-steps {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  margin-bottom: 40px;
}
.hero-step {
  flex: 1;
  max-width: 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: left;
}
.hero-step-num {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}
.hero-step h4 { font-size: 14px; margin-bottom: 6px; }
.hero-step p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.hero-step-arrow { align-self: center; color: var(--muted); font-size: 18px; padding: 0 4px; }
@media (max-width: 640px) {
  .hero-steps { flex-direction: column; align-items: center; }
  .hero-step { max-width: 340px; width: 100%; }
  .hero-step-arrow { transform: rotate(90deg); padding: 2px 0; }
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-3px); border-color: #3a4260; }
.card-thumb {
  position: relative;
  display: flex;
  height: 158px;
  background: var(--bg-soft);
  gap: 2px;
}
.card-thumb img { flex: 1; min-width: 0; object-fit: cover; height: 100%; }
.card-chip { position: absolute; top: 10px; left: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.45); }
.card-body { padding: 16px; }
.card-body h3 { font-size: 16px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: flex; gap: 8px; }
.card-actions .btn { padding: 8px 13px; font-size: 13px; }
.card-actions .grow { flex: 1; }

.site-footer {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
}

/* ---------- modal / wizard ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.7);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
  overflow-y: auto;
}
.modal {
  width: min(640px, 100%);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-head h2 { font-size: 18px; }
.step-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 16px;
}

.type-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 600px) { .type-choices { grid-template-columns: 1fr; } }
.type-card {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.type-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.type-card h3 { font-size: 15px; }
.type-card p { font-size: 12.5px; color: var(--muted); line-height: 1.5; flex: 1; }

/* mini SVG diagrams on type cards */
.type-art {
  width: 100%;
  height: auto;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 0;
}
.type-art .ta-line   { stroke: #7a849e; stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.type-art .ta-dash   { stroke: #7a849e; stroke-width: 2; fill: none; stroke-dasharray: 4 4; stroke-linecap: round; }
.type-art .ta-tick   { fill: #7a849e; stroke: none; }
.type-art .ta-accent { fill: rgba(124, 92, 255, 0.14); }
.type-art .ta-accent path { stroke: #8f7bff; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }

/* stepper */
.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.stepper-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.stepper-item .dot {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 11.5px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.stepper-item.active { color: var(--text); }
.stepper-item.active .dot { background: var(--grad); border: none; color: #fff; }
.stepper-line { flex: 1; height: 1px; background: var(--line); min-width: 12px; }

/* mat preview */
.mat-preview-wrap {
  display: flex;
  gap: 16px;
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
#mat-canvas {
  width: 190px;
  height: 190px;
  border-radius: 10px;
  background: #fff;
  flex: none;
}
.mat-preview-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.mat-preview-side .hint { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.mat-preview-side .btn { align-self: flex-start; padding: 8px 14px; font-size: 13px; }
@media (max-width: 540px) {
  .mat-preview-wrap { flex-direction: column; align-items: center; text-align: center; }
  .mat-preview-side .btn { align-self: center; }
}

/* share modal */
.share-intro {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 18px;
}
.share-steps {
  list-style: none;
  counter-reset: sharestep;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}
.share-steps li {
  counter-increment: sharestep;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 40px;
  position: relative;
  font-size: 14px;
}
.share-steps li::before {
  content: counter(sharestep);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}
.share-steps .hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.share-steps .btn { align-self: flex-start; padding: 8px 14px; font-size: 13px; }
.share-steps input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.share-steps input:focus { border-color: var(--accent); }
.share-result {
  background: rgba(61, 220, 151, 0.07);
  border: 1px solid rgba(61, 220, 151, 0.35);
  border-radius: var(--radius);
  padding: 14px;
}
.share-result > span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ok);
  margin-bottom: 8px;
}
.share-link-row { display: flex; gap: 8px; }
.share-link-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
  outline: none;
}
.share-link-row .btn { padding: 8px 14px; font-size: 13px; white-space: nowrap; }

/* library toolbar (search + filters) */
.library-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.library-toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
  max-width: 340px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.library-toolbar input[type="search"]:focus { border-color: var(--accent); }
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip.filter {
  cursor: pointer;
  background: var(--panel);
  transition: border-color 0.12s ease, color 0.12s ease;
}
.chip.filter:hover { border-color: var(--accent); color: var(--text); }
.chip.filter.active {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
}
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 40px 0;
}

/* help modal */
.help-body { display: flex; flex-direction: column; gap: 18px; }
.help-body section h3 {
  font-size: 14.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-body section p { font-size: 13px; color: var(--muted); line-height: 1.65; }
.help-body a { color: var(--accent-2); text-decoration: none; }
.help-body a:hover { text-decoration: underline; }

/* recording state */
.hud-btn.rec {
  border-color: rgba(255, 92, 122, 0.7);
  background: rgba(120, 20, 40, 0.55);
  animation: rec-pulse 1.4s ease-in-out infinite;
}
.hud-status.rec { color: #ff5c7a; border-color: rgba(255, 92, 122, 0.5); }
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 92, 122, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 92, 122, 0); }
}
.hud-btn.active {
  border-color: rgba(124, 92, 255, 0.8);
  background: rgba(60, 40, 130, 0.6);
}

/* QR boxes */
.qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  width: 180px;
  margin: 14px auto 0;
}
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-box.lg { width: 240px; margin-top: 4px; }
.modal.narrow { width: min(360px, 100%); }
.hint.centered { text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: 14px; }

/* AR photo shutter flash */
.shutter-flash {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 200;
  pointer-events: none;
  animation: shutter 0.45s ease-out forwards;
}
@keyframes shutter {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* whole-page drag-to-import cue */
body.drag-active::after {
  content: 'Drop .anchor.json to import';
  position: fixed;
  inset: 12px;
  z-index: 90;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  background: rgba(11, 13, 18, 0.75);
  border: 2px dashed var(--accent);
  border-radius: 18px;
  pointer-events: none;
}

/* toasts */
.toast-holder {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(90vw, 480px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(61, 220, 151, 0.4); }
.toast.err { border-color: rgba(255, 92, 122, 0.5); color: #ffb3c1; }

.field { display: block; margin-bottom: 18px; }
.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.field input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.field input[type="text"]:focus { border-color: var(--accent); }
.field select.select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.field select.select:focus { border-color: var(--accent); }

.drop-zone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  font-size: 14px;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(124, 92, 255, 0.06);
}
.drop-zone .hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.drop-zone.compact { padding: 14px; font-size: 13px; }
.drop-zone.compact .hint { margin-top: 4px; }
.drop-zone .hint a { color: var(--accent-2); text-decoration: none; }
.drop-zone .hint a:hover { text-decoration: underline; }

.thumb-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.thumb {
  position: relative;
  width: 74px; height: 74px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-x {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 10px;
  cursor: pointer;
}
.file-pill {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.compile-box { text-align: center; padding: 24px 8px; }
.compile-box p { margin-top: 14px; font-size: 14px; }
.compile-box .hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--grad);
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ---------- live examples row ---------- */
.demo-row { margin-bottom: 32px; }
.demo-row-head { margin-bottom: 14px; }
.demo-row-head h2 { font-size: 17px; margin-bottom: 3px; }
.demo-row-head p { font-size: 13px; color: var(--muted); }
.demo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.demo-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(var(--panel), var(--panel)) padding-box,
              linear-gradient(135deg, rgba(124, 92, 255, 0.55), rgba(53, 208, 255, 0.35)) border-box;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.demo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.18);
}
.demo-card-icon { font-size: 34px; flex: none; }
.demo-card-body { flex: 1; min-width: 0; }
.demo-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.demo-card-title h3 { font-size: 15.5px; }
.demo-card-body p { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 7px; }
.demo-needs { font-size: 11.5px; color: var(--accent-2); font-weight: 600; }
.demo-go {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.4);
}

/* ============ Viewer ============ */
.viewer-body { overflow: hidden; height: 100dvh; }

#ar-container {
  position: fixed;
  inset: 0;
  touch-action: none; /* required for pointer-gesture rotate/scale */
}
#ar-container video, #ar-container canvas { position: absolute; inset: 0; }

.viewer-gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(700px 400px at 50% 0%, rgba(124, 92, 255, 0.18), transparent 60%),
    var(--bg);
  z-index: 20;
  padding: 20px;
}
.gate-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  max-width: 380px;
}
.gate-card h2 { font-size: 22px; }
.gate-card p { color: var(--muted); font-size: 14px; }
.gate-error {
  color: var(--danger);
  background: rgba(255, 92, 122, 0.1);
  border: 1px solid rgba(255, 92, 122, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  line-height: 1.5;
}
.gate-marker {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  text-align: left;
}
.gate-marker img {
  width: 96px;
  border-radius: 8px;
  background: #fff;
  flex: none;
}
.gate-marker p { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.gate-marker .btn { padding: 7px 12px; font-size: 12.5px; }

/* ---------- object viewer (WebAR.rocks) media elements ---------- */
/* Positioning mirrors the upstream WebAR.rocks demos: video feed behind,
   transparent three.js canvas on top, detection canvas hidden. */
.object-body { touch-action: none; } /* enables drag/pinch pointer gestures */
.object-body #ARCanvas { display: none; }
.object-body #webcamVideo { z-index: 1; object-fit: cover; }
.object-body #threeCanvas { z-index: 2; }
.object-body #threeCanvas,
.object-body #webcamVideo {
  position: fixed;
  left: 50%;
  top: 0;
  height: 100% !important;
  width: 100vw !important;
  max-width: 100vh !important;
  transform: translate(-50%);
}
.object-body .viewer-gate { z-index: 20; }
.object-body .viewer-hud { z-index: 10; }

.viewer-hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hud-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(rgba(5, 7, 12, 0.7), transparent);
}
.hud-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hud-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(11, 13, 18, 0.6);
  border-radius: 999px;
  padding: 5px 12px;
}
.hud-status.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.4); }

.hud-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(11, 13, 18, 0.72);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  backdrop-filter: blur(8px);
}
.hud-btn:active { transform: scale(0.96); }
.hud-btn.wide { font-size: 13px; }

.hud-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(5, 7, 12, 0.7));
}
.hud-hintline { font-size: 12px; color: rgba(238, 241, 248, 0.75); text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
.hud-buttons { display: flex; gap: 10px; }

/* scanning overlay */
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
}
.scan-overlay p {
  font-size: 14px;
  color: rgba(238, 241, 248, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.scan-frame {
  width: min(62vw, 280px);
  aspect-ratio: 1;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  --c: rgba(124, 92, 255, 0.9);
  background:
    linear-gradient(var(--c), var(--c)) top left / 34px 3px,
    linear-gradient(var(--c), var(--c)) top left / 3px 34px,
    linear-gradient(var(--c), var(--c)) top right / 34px 3px,
    linear-gradient(var(--c), var(--c)) top right / 3px 34px,
    linear-gradient(var(--c), var(--c)) bottom left / 34px 3px,
    linear-gradient(var(--c), var(--c)) bottom left / 3px 34px,
    linear-gradient(var(--c), var(--c)) bottom right / 34px 3px,
    linear-gradient(var(--c), var(--c)) bottom right / 3px 34px;
  background-repeat: no-repeat;
}
.scan-line {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  animation: scan 2.2s ease-in-out infinite;
}
@keyframes scan {
  0%, 100% { top: 12%; opacity: 0.4; }
  50% { top: 86%; opacity: 1; }
}
