#app .reference-address-editor {
  --editor-rpx: min(calc(100vw / 750), calc(520px / 750));
  --editor-gutter: calc(var(--editor-rpx) * 30);
  --editor-label-width: calc(var(--editor-rpx) * 200);
  --editor-label-size: calc(var(--editor-rpx) * 29);
  --editor-input-size: calc(var(--editor-rpx) * 30);
  --editor-header-space: calc(var(--editor-rpx) * 15);
  --editor-footer-space: calc(var(--editor-rpx) * 20);
  --editor-button-height: calc(var(--editor-rpx) * 80);
  --editor-background: #f2f4fd;
  --editor-blue: #3c9cff;
  display: block;
  min-height: calc(100svh - 44px - env(safe-area-inset-top));
  padding: calc(var(--editor-header-space) + 1px) 0 calc(var(--editor-rpx) * 120 + env(safe-area-inset-bottom));
  background: var(--editor-background);
  font-family: 'Times New Roman', 'Microsoft YaHei', 'PingFang SC', serif;
}
@supports (width: round(down, 3px, 1px)) {
  #app .reference-address-editor {
    --editor-gutter: round(down, calc(var(--editor-rpx) * 30), 1px);
    --editor-label-width: round(down, calc(var(--editor-rpx) * 200), 1px);
    --editor-label-size: round(down, calc(var(--editor-rpx) * 29), 1px);
    --editor-input-size: round(down, calc(var(--editor-rpx) * 30), 1px);
    --editor-header-space: round(down, calc(var(--editor-rpx) * 15), 1px);
    --editor-footer-space: round(down, calc(var(--editor-rpx) * 20), 1px);
    --editor-button-height: round(down, calc(var(--editor-rpx) * 80), 1px);
  }
}

.address-editor-form { background: #fff; }
.address-editor-row {
  display: grid;
  grid-template-columns: var(--editor-label-width) minmax(0, 1fr);
  padding: var(--editor-gutter);
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  font-size: var(--editor-label-size);
  line-height: 1.4;
}
.address-editor-required { color: #ff4d4f; margin-left: calc(var(--editor-rpx) * 8); }
.address-editor-row > :is(input, textarea, .address-editor-region) {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #191919;
  font-family: 'Times New Roman', 'Microsoft YaHei Light', 'Microsoft YaHei', 'PingFang SC', serif;
  font-size: var(--editor-input-size);
  font-weight: 330;
  line-height: 1.4;
}
.address-editor-row > :is(input, textarea)::placeholder { color: #808080; opacity: 1; }
.address-editor-row > textarea { height: 150px; resize: none; }
.address-editor-row > .address-editor-region {
  font-size: var(--editor-label-size);
  line-height: max(22px, 1.4em);
  text-align: left;
  overflow-wrap: anywhere;
}

.address-editor-switch {
  position: relative;
  display: block;
  width: calc(var(--editor-rpx) * 80);
  height: calc(var(--editor-rpx) * 48);
}
.address-editor-switch input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.address-editor-switch > span {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--editor-rpx) * 28);
  background: #ddd;
  transition: background .3s;
}
.address-editor-switch > span::before {
  content: '';
  position: absolute;
  top: calc(var(--editor-rpx) * 2);
  left: calc(var(--editor-rpx) * 2);
  width: calc(var(--editor-rpx) * 44);
  height: calc(var(--editor-rpx) * 44);
  border-radius: 50%;
  background: #fff;
  transition: left .3s, transform .3s;
}
.address-editor-switch input:checked + span { background: var(--editor-blue); }
.address-editor-switch input:checked + span::before { transform: translateX(calc(var(--editor-rpx) * 32)); }
.address-editor-switch input:focus-visible + span { outline: 2px solid var(--editor-blue); outline-offset: 3px; }
@supports (width: round(down, 3px, 1px)) {
  .address-editor-switch {
    width: round(down, calc(var(--editor-rpx) * 80), 1px);
    height: round(down, calc(var(--editor-rpx) * 48), 1px);
  }
  .address-editor-switch > span::before {
    top: round(down, calc(var(--editor-rpx) * 2), 1px);
    left: round(down, calc(var(--editor-rpx) * 2), 1px);
    width: round(down, calc(var(--editor-rpx) * 44), 1px);
    height: round(down, calc(var(--editor-rpx) * 44), 1px);
  }
  .address-editor-switch input:checked + span::before {
    left: round(down, calc(var(--editor-rpx) * 34), 1px);
    transform: none;
  }
}

.address-editor-footer {
  position: fixed;
  z-index: 20;
  inset: auto 0 0;
  width: min(100%, 520px);
  margin-inline: auto;
  padding: var(--editor-footer-space) var(--editor-gutter)
    calc(var(--editor-footer-space) + env(safe-area-inset-bottom));
  background: var(--editor-background);
  box-shadow: 0 -1px 5px rgb(0 0 0 / 5%);
}
.address-editor-footer button {
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--editor-button-height);
  padding: 0;
  border: 0;
  border-radius: calc(var(--editor-rpx) * 12);
  background: var(--editor-blue);
  color: #fff;
  font-size: calc(var(--editor-rpx) * 33);
}
.address-editor-footer button:disabled { opacity: .65; }

.address-editor-picker {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 520px);
  max-width: none;
  margin: 0 auto;
  padding: 0 0 env(safe-area-inset-bottom);
  overflow: hidden;
  border-radius: 0;
  background: #fff;
  color: #333;
  box-shadow: none;
}
.address-editor-picker::backdrop { background: rgb(0 0 0 / 50%); }
.address-picker-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--editor-gutter);
  border-bottom: 1px solid #f0f0f0;
  font-size: 16px;
  line-height: 21px;
}
.address-picker-heading button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #666;
  font-size: calc(var(--editor-rpx) * 26);
}
.address-picker-wheels {
  --wheel-height: min(calc(var(--editor-rpx) * 600), 65dvh);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: relative;
}
.address-picker-wheels::before,
.address-picker-wheels::after {
  content: '';
  position: absolute;
  z-index: 1;
  pointer-events: none;
}
.address-picker-wheels::before {
  inset: 0;
  background: linear-gradient(to bottom, #fff, transparent calc(50% - 17px),
    transparent calc(50% + 17px), #fff);
}
.address-picker-wheels::after {
  inset: calc(50% - 17px) 0 auto;
  height: 34px;
  border-block: 1px solid #eee;
}
.address-picker-wheels [data-region-wheel] {
  height: var(--wheel-height);
  padding-block: calc((var(--wheel-height) - 34px) / 2);
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  scroll-snap-type: y mandatory;
  text-align: center;
  touch-action: pan-y;
}
.address-picker-wheels [data-region-option] {
  height: 34px;
  padding-inline: 2px;
  overflow: hidden;
  font-size: 16px;
  line-height: normal;
  overflow-wrap: anywhere;
  scroll-snap-align: center;
  cursor: pointer;
}
