/* Car AR — bare UI */

.car-body {
  --accent: #e8f2f4;
  --accent-ink: #06090b;
  background: #05080a;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

#backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(110% 75% at 50% 20%, #182026 0%, #0a0f12 46%, #05080a 80%);
}

#stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
}

#stage canvas {
  touch-action: none;
}

#camerafeed {
  display: none;
}

.car-body.ar-running #stage,
.car-body.ar-running #backdrop,
.car-body.ar-running #landing,
.car-body.ar-running #device,
.car-body.ar-running #previewbar {
  display: none !important;
}

.car-body.ar-running #camerafeed {
  display: block;
}

#ui {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

/* -- panels ------------------------------------------------------- */

.panel {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(400px, calc(100vw - 24px));
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background: rgba(5, 9, 11, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}

.panel.centered {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
}

.panel h1 {
  font: 600 25px/1.1 "Inter", system-ui, sans-serif;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.panel h2 {
  font: 600 19px/1.2 "Inter", system-ui, sans-serif;
  margin: 0 0 6px;
}

.panel p {
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 14px;
}

/* -- buttons ------------------------------------------------------ */

.btn {
  width: 100%;
  height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font: 600 13px "Inter", system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: #06090b;
  background: #f2f6f7;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 120ms ease, transform 120ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
}

.btn.ghost {
  background: transparent;
  color: #eef4f5;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn[aria-pressed="true"] {
  background: #8ff4ff;
  color: #041014;
}

.panel .btn + .btn {
  margin-top: 8px;
}

.bar {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(5, 9, 11, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

.bar .btn {
  margin-top: 0;
  width: auto;
  height: 40px;
  padding: 0 14px;
  flex: 0 0 auto;
}

#scan {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

#scan p {
  margin: 2px 4px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.72);
}

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

#scan .row .btn {
  flex: 1;
  width: auto;
}

#world .btn,
#previewbar .btn {
  flex: 0 0 auto;
}

#world #doors,
#previewbar #p-doors {
  flex: 1;
}

/* -- colours ------------------------------------------------------ */

.colors {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 4px;
}

.color {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  box-shadow: 0 0 0 0 transparent;
}

.color[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #05080a, 0 0 0 3px #8ff4ff;
}

/* -- attribution (required by the engine licence) ------------------ */

.attrib {
  font-size: 10px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.33);
}

.attrib a {
  color: rgba(255, 255, 255, 0.48);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.attrib.fixed {
  position: fixed;
  left: 50%;
  bottom: calc(2px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 7;
  white-space: nowrap;
  pointer-events: auto;
  font-size: 9px;
}

/* -- qr ----------------------------------------------------------- */

#qr {
  display: block;
  width: 176px;
  height: 176px;
  margin: 6px auto 14px;
  padding: 8px;
  border-radius: 10px;
  background: #f2f2ee;
  image-rendering: pixelated;
}

/* -- reticle ------------------------------------------------------ */

.car-body .reticle {
  z-index: 6;
}

/* -- toast -------------------------------------------------------- */

.car-body .toast {
  z-index: 8;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

/* -- ar camera vignette (kept minimal) ---------------------------- */

.car-body.ar-running::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.32), transparent 24%);
}

/* -- desktop tuning ----------------------------------------------- */

@media (min-width: 900px) {
  .panel {
    left: clamp(32px, 6vw, 96px);
    bottom: 30px;
    transform: none;
    width: 360px;
  }
  .panel.centered {
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
  }
  .bar {
    bottom: 26px;
  }
}
