[x-cloak] {
  display: none !important;
}

.wire-box {
  gap: clamp(1.25rem, 1.8vw, 2rem);
}

.wire-box > div {
  margin-left: 0 !important;
}

/* 窄屏先展示整车，再按装修顺序排配件；奇数项的最后一行自然居中。 */
.parts-orbit-scene {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  width: min(100%, 640px);
  container-type: inline-size;
  isolation: isolate;
}

.parts-orbit-center {
  grid-area: 1 / 1;
  width: min(96%, 375px);
  justify-self: center;
}

.parts-vehicle-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 952 / 492;
  object-fit: contain;
}

.parts-orbit-ring {
  --gap: clamp(8px, 3cqi, 18px);
  grid-area: 2 / 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--gap);
  margin: clamp(12px, 4cqi, 24px) 0 0;
  padding: clamp(12px, 4cqi, 24px) 0 0;
  border-top: 1px solid #e5e9ec;
  list-style: none;
}

.parts-orbit-ring:not(:has(.parts-orbit-item)) {
  display: none;
}

.parts-orbit-item {
  width: min(calc((100% - var(--gap)) / 2), 168px);
  height: clamp(72px, 22cqi, 92px);
}

.parts-orbit-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.parts-playback {
  grid-area: 1 / 1;
  place-self: end;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 4px;
  border: 1px solid #c9d2d8;
  border-radius: 50%;
  background: #fff;
  color: #143349;
  cursor: pointer;
}

.parts-playback[hidden] {
  display: none;
}

.parts-playback::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 3px;
  border-block: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.parts-orbit-scene[data-playing] .parts-playback::before {
  width: 10px;
  height: 12px;
  margin: 0;
  border: 0;
  border-inline: 3px solid currentColor;
}

.parts-playback:focus-visible {
  outline: 2px solid #143349;
  outline-offset: 3px;
}

/* 半径和图卡都按当前栏宽计算，转到左右边缘时仍留有余量。超过八项继续使用换行布局。 */
@media (min-width: 768px) {
  .parts-orbit-scene:has(.parts-orbit-item):not(:has(.parts-orbit-item:nth-of-type(9))) {
    aspect-ratio: 1;

    &::before {
      content: "";
      position: absolute;
      inset: 14%;
      border: 1px solid #e4e8eb;
      border-radius: 50%;
      pointer-events: none;
    }

    & .parts-orbit-center {
      width: 56%;
    }

    & .parts-orbit-ring {
      grid-area: 1 / 1;
      position: relative;
      align-self: stretch;
      margin: 0;
      padding: 0;
      border: 0;
      animation: parts-turn var(--parts-orbit-duration, 28s) linear infinite paused;
    }

    & .parts-orbit-item {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 23cqi;
      height: 16.5cqi;
      transform: translate(-50%, -50%) rotate(var(--orbit-angle)) translateY(-36cqi) rotate(calc(-1 * var(--orbit-angle)));
    }

    & .parts-orbit-item img {
      animation: parts-turn var(--parts-orbit-duration, 28s) linear infinite reverse paused;
    }

    &[data-playing] .parts-orbit-ring,
    &[data-playing] .parts-orbit-item img {
      animation-play-state: running;
    }
  }
}

@keyframes parts-turn {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
