/* 绘城智算 Alpha2 Preview1，全部样式限定在 hc-preview1 命名空间。 */
#resultBox.hc-preview1-ready {
  display: block !important;
  padding: 0 !important;
  background: #020617 !important;
  text-align: left !important;
}

.hc-preview1-wait,
.hc-preview1-failure {
  position: relative;
  z-index: 2;
  width: min(520px, 88%);
  margin: 0 auto;
  padding: 42px 28px;
  text-align: center;
}

.hc-preview1-wait h3,
.hc-preview1-failure h3 {
  margin: 18px 0 8px;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
}

.hc-preview1-wait p,
.hc-preview1-failure p {
  margin: 8px 0;
  color: rgba(255, 255, 255, .72);
}

.hc-preview1-wait small {
  display: block;
  margin-top: 12px;
  color: rgba(255, 255, 255, .48);
}

.hc-preview1-orbit {
  position: relative;
  width: 118px;
  height: 118px;
  margin: 0 auto;
  border: 1px solid rgba(34, 211, 238, .24);
  border-radius: 50%;
  box-shadow: 0 0 42px rgba(34, 211, 238, .16);
}

.hc-preview1-orbit img {
  position: absolute;
  inset: 25px;
  width: calc(100% - 50px);
  height: calc(100% - 50px);
  object-fit: contain;
}

.hc-preview1-orbit span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px;
  border-radius: 50%;
  background: #67e8f9;
  box-shadow: 0 0 16px #22d3ee;
  animation: hcPreview1Orbit 2.8s linear infinite;
}

.hc-preview1-orbit span:nth-child(2) {
  animation-delay: -.9s;
  background: #60a5fa;
}

.hc-preview1-orbit span:nth-child(3) {
  animation-delay: -1.8s;
  background: #a78bfa;
}

@keyframes hcPreview1Orbit {
  from { transform: rotate(0deg) translateX(56px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(56px) rotate(-360deg); }
}

.hc-preview1-progress {
  height: 9px;
  margin: 20px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
}

.hc-preview1-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #3b82f6, #8b5cf6);
  box-shadow: 0 0 20px rgba(34, 211, 238, .45);
  transition: width .45s ease;
}

.hc-preview1-progress.compact {
  width: min(420px, 60vw);
  height: 6px;
  margin: 10px 0 6px;
}

.hc-preview1-shell {
  position: relative;
  width: 100%;
  min-height: 680px;
  overflow: hidden;
  background: #020617;
}

.hc-preview1-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transform: scale(1);
  transition: opacity .18s ease, transform .3s ease;
}

.hc-preview1-image.is-updating {
  opacity: .55;
  transform: scale(1.008);
}

.hc-preview1-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, .5), transparent 28%),
    linear-gradient(0deg, rgba(2, 6, 23, .9), transparent 42%);
  pointer-events: none;
}

.hc-preview1-topbar,
.hc-preview1-footer {
  position: absolute;
  z-index: 4;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hc-preview1-topbar {
  top: 18px;
}

.hc-preview1-footer {
  bottom: 18px;
  align-items: flex-end;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 20px;
  background: rgba(2, 6, 23, .74);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .32);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hc-preview1-badge,
.hc-preview1-price {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  color: #fff;
  background: rgba(2, 6, 23, .72);
  font-size: 12px;
  font-weight: 900;
  backdrop-filter: blur(12px);
}

.hc-preview1-badge {
  background: linear-gradient(135deg, rgba(34, 211, 238, .9), rgba(59, 130, 246, .9));
}

.hc-preview1-shell.is-approved .hc-preview1-badge {
  background: linear-gradient(135deg, #10b981, #059669);
}

.hc-preview1-shell.needs-refinement .hc-preview1-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.hc-preview1-copy strong {
  display: block;
  font-size: 18px;
  color: #fff;
}

.hc-preview1-copy p,
.hc-preview1-copy small {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, .68);
  font-size: 12px;
}

.hc-preview1-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hc-preview1-actions button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 13px;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.hc-preview1-actions button:hover {
  background: rgba(255, 255, 255, .18);
}

.hc-preview1-failure i {
  color: #fb7185;
  font-size: 42px;
}

@media (max-width: 768px) {
  .hc-preview1-shell {
    min-height: 520px;
  }

  .hc-preview1-topbar {
    left: 10px;
    right: 10px;
    top: 10px;
  }

  .hc-preview1-price {
    max-width: 58%;
    text-align: center;
  }

  .hc-preview1-footer {
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: block;
    padding: 12px;
  }

  .hc-preview1-progress.compact {
    width: 100%;
  }

  .hc-preview1-actions {
    margin-top: 12px;
    justify-content: stretch;
  }

  .hc-preview1-actions button {
    flex: 1 1 auto;
  }
}


/* Preview1.2 局部重绘入口与蒙版编辑器 */
.hc-preview1-actions button[data-preview1-action="local-redraw"] {
  border-color: rgba(34, 211, 238, .42);
  background: linear-gradient(
    135deg,
    rgba(6, 182, 212, .24),
    rgba(59, 130, 246, .22)
  );
}

.hc-preview1-actions button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

body.hc-local-redraw-open {
  overflow: hidden;
}

.hc-local-redraw-modal {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 23, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hc-local-redraw-panel {
  width: min(1180px, 96vw);
  max-height: 94vh;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 24px;
  color: #fff;
  background: #07101f;
  box-shadow: 0 28px 100px rgba(0, 0, 0, .58);
}

.hc-local-redraw-header,
.hc-local-redraw-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.hc-local-redraw-footer {
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, .09);
  border-bottom: 0;
}

.hc-local-redraw-header strong {
  display: block;
  font-size: 21px;
}

.hc-local-redraw-header p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, .62);
  font-size: 13px;
}

.hc-local-redraw-header button,
.hc-local-redraw-footer button,
.hc-local-redraw-tool-buttons button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 13px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font-weight: 800;
  cursor: pointer;
}

.hc-local-redraw-header button {
  width: 42px;
  padding: 0;
  font-size: 26px;
}

.hc-local-redraw-footer button.primary {
  border-color: rgba(34, 211, 238, .5);
  background: linear-gradient(135deg, #0891b2, #2563eb);
}

.hc-local-redraw-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  padding: 18px;
}

.hc-local-redraw-stage {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 18px;
  background: #020617;
  user-select: none;
  touch-action: none;
}

.hc-local-redraw-stage img,
.hc-local-redraw-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hc-local-redraw-stage canvas {
  z-index: 3;
  cursor: crosshair;
  touch-action: none;
}

.hc-local-redraw-hint {
  position: absolute;
  z-index: 5;
  left: 14px;
  bottom: 14px;
  padding: 8px 11px;
  border-radius: 999px;
  color: #fff;
  background: rgba(2, 6, 23, .74);
  font-size: 12px;
  pointer-events: none;
}

.hc-local-redraw-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 18px;
  background: rgba(255, 255, 255, .035);
}

.hc-local-redraw-tools label {
  color: rgba(255, 255, 255, .82);
  font-size: 13px;
  font-weight: 800;
}

.hc-local-redraw-tools input[type="range"] {
  width: 100%;
  accent-color: #22d3ee;
}

.hc-local-redraw-tool-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hc-local-redraw-tools textarea {
  min-height: 150px;
  resize: vertical;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 13px;
  outline: 0;
  color: #fff;
  background: rgba(2, 6, 23, .78);
  line-height: 1.55;
}

.hc-local-redraw-tools textarea:focus {
  border-color: rgba(34, 211, 238, .62);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .12);
}

.hc-local-redraw-tools small {
  color: rgba(255, 255, 255, .48);
  line-height: 1.55;
}

.hc-local-redraw-status {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .045);
  font-size: 12px;
  line-height: 1.5;
}

.hc-local-redraw-status.is-success {
  color: #a7f3d0;
  background: rgba(16, 185, 129, .12);
}

.hc-local-redraw-status.is-error {
  color: #fecdd3;
  background: rgba(244, 63, 94, .12);
}

.hc-local-redraw-status.is-working {
  color: #bae6fd;
  background: rgba(14, 165, 233, .12);
}

@media (max-width: 860px) {
  .hc-local-redraw-modal {
    padding: 8px;
  }

  .hc-local-redraw-panel {
    width: 100%;
    max-height: 98vh;
    border-radius: 17px;
  }

  .hc-local-redraw-workspace {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .hc-local-redraw-stage {
    min-height: 360px;
  }

  .hc-local-redraw-tools textarea {
    min-height: 110px;
  }
}


/* Preview1.3 真实局部重绘影子结果 */
.hc-local-redraw-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hc-local-redraw-result-actions[hidden] {
  display: none;
}

.hc-local-redraw-result-actions button {
  min-height: 42px;
  border: 1px solid rgba(34, 211, 238, .28);
  border-radius: 12px;
  color: #e0f2fe;
  background: rgba(8, 145, 178, .12);
  font-weight: 800;
  cursor: pointer;
}

.hc-local-redraw-footer button:disabled {
  opacity: .5;
  cursor: not-allowed;
}
