:root {
  color-scheme: light;
}

body.hf-mode {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background: #201f20;
}

body.hf-mode #app {
  min-height: 100vh;
}

.hf-root {
  box-sizing: border-box;
  min-height: 100vh;
  padding: 20px;
  display: grid;
  place-items: center;
  background: #201f20;
}

.hf-stage {
  position: relative;
  width: min(1440px, calc(100vw - 40px));
  aspect-ratio: 1440 / 1024;
  overflow: hidden;
  background: #fcf8ff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
}

.hf-screen,
.hf-modal-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hf-screen {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.hf-hotspot {
  position: absolute;
  z-index: 2;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.hf-hotspot:focus-visible {
  outline: 3px solid #6541b2;
  outline-offset: -3px;
}

.hf-modal-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(41, 37, 46, 0.42);
}

.hf-modal {
  position: relative;
  width: min(720px, 76%);
  aspect-ratio: 720 / 548;
  box-shadow: 0 20px 44px rgba(41, 37, 46, 0.25);
}

.hf-modal .hf-hotspot {
  z-index: 5;
}

.hf-ai-product-chip,
.hf-ai-live,
.hf-ai-result-panel {
  position: absolute;
  z-index: 6;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #292531;
}

.hf-ai-product-chip {
  left: 20.5%;
  top: 16%;
  max-width: 39%;
  border: 1px solid #d6c7f7;
  border-radius: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #6541b2;
  font-size: 13px;
  cursor: pointer;
}

.hf-ai-live {
  left: 24%;
  top: 38%;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 52%;
  box-sizing: border-box;
  border: 1px solid #d9c9f7;
  border-radius: 8px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 14px 28px rgba(54, 41, 77, 0.16);
}

.hf-ai-live.error {
  border-color: #efc6be;
}

.hf-ai-live strong,
.hf-ai-result-panel strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

.hf-ai-live p,
.hf-ai-result-panel p,
.hf-ai-result-panel dd {
  margin: 6px 0 0;
  color: #716b79;
  font-size: 13px;
  line-height: 1.55;
}

.hf-ai-spinner {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 4px solid #e9dffd;
  border-top-color: #6541b2;
  border-radius: 50%;
  animation: hf-spin 0.9s linear infinite;
}

.hf-ai-button {
  min-height: 34px;
  border: 1px solid #c8b4f6;
  border-radius: 6px;
  padding: 7px 12px;
  color: #6541b2;
  background: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.hf-ai-button.primary {
  border-color: #6541b2;
  background: #6541b2;
  color: #fff;
}

.hf-ai-button.ghost {
  background: #f4eeff;
}

.hf-ai-result-panel {
  top: 18%;
  right: 2.8%;
  width: 26%;
  max-height: 62%;
  box-sizing: border-box;
  overflow: auto;
  border: 1px solid #ddd1e9;
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 28px rgba(54, 41, 77, 0.12);
}

.hf-ai-result-panel.empty {
  top: 31%;
}

.hf-ai-panel-head,
.hf-ai-panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hf-ai-panel-actions {
  margin-top: 16px;
}

.hf-ai-eyebrow {
  margin: 0 0 4px !important;
  color: #6541b2 !important;
  font-size: 11px !important;
}

.hf-ai-status {
  border-radius: 999px;
  padding: 4px 8px;
  background: #e9f7d5;
  color: #4d7a49;
  font-size: 11px;
  white-space: nowrap;
}

.hf-ai-status.review,
.hf-ai-warning {
  background: #fff2d7;
  color: #966e2b;
}

.hf-ai-success {
  border-radius: 4px;
  padding: 7px 8px;
  background: #e9f7d5;
  color: #4d7a49 !important;
}

.hf-ai-result-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 14px 0;
}

.hf-ai-result-tab {
  border: 1px solid #ded1eb;
  border-radius: 4px;
  padding: 5px 2px;
  background: #fff;
  color: #716b79;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.hf-ai-result-tab.active {
  border-color: #6541b2;
  background: #f0e8ff;
  color: #6541b2;
}

.hf-ai-result-panel h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.hf-ai-copy {
  color: #403a49 !important;
}

.hf-ai-result-panel dl {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.hf-ai-result-panel dl div {
  border-top: 1px solid #eee7f4;
  padding-top: 8px;
}

.hf-ai-result-panel dt {
  color: #716b79;
  font-size: 11px;
}

.hf-ai-result-panel dd {
  margin-left: 0;
}

.hf-ai-warning {
  border-radius: 4px;
  padding: 7px 8px;
}

.hf-ai-modal-layer {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(41, 37, 46, 0.46);
}

.hf-ai-editor {
  display: grid;
  gap: 12px;
  width: min(420px, 82%);
  box-sizing: border-box;
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  box-shadow: 0 20px 44px rgba(41, 37, 46, 0.28);
  color: #292531;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hf-ai-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.hf-ai-editor h2 {
  margin: 0;
  font-size: 20px;
}

.hf-ai-editor label {
  display: grid;
  gap: 6px;
  color: #514b59;
  font-size: 13px;
}

.hf-ai-editor input,
.hf-ai-editor textarea,
.hf-ai-editor select {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #dcd2e7;
  border-radius: 5px;
  padding: 9px 10px;
  color: #292531;
  background: #fff;
  font: inherit;
  font-size: 13px;
}

.hf-template-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hf-ai-editor textarea {
  min-height: 58px;
  resize: vertical;
}

.hf-ai-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.hf-ai-icon {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #716b79;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.hf-image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.hf-template-editor {
  width: min(560px, 88%);
  max-height: 88%;
  overflow-y: auto;
}

.hf-template-editor fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.hf-template-editor legend {
  margin-bottom: 6px;
  color: #514b59;
  font-size: 13px;
}

.hf-template-segments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.hf-template-segments.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hf-template-segments button {
  display: grid;
  min-height: 36px;
  box-sizing: border-box;
  place-items: center;
  border: 1px solid #dcd2e7;
  border-radius: 5px;
  padding: 7px 10px;
  background: #fff;
  color: #514b59;
  font: inherit;
  cursor: pointer;
}

.hf-template-segments button[aria-pressed="true"] {
  border-color: #6541b2;
  background: #f0e8ff;
  color: #6541b2;
}

.hf-template-segments button:focus-visible {
  outline: 2px solid #6541b2;
  outline-offset: 2px;
}

.hf-template-editor input[type="number"] {
  width: 110px;
}

.hf-template-summary,
.hf-template-toast,
.hf-template-choice-highlight,
.hf-saved-template {
  position: absolute;
  z-index: 6;
  box-sizing: border-box;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.hf-saved-template {
  top: 56%;
  right: 4.7%;
  display: grid;
  gap: 7px;
  width: 22.5%;
  border: 1px solid #d8caeb;
  border-radius: 7px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.98);
  color: #292531;
  box-shadow: 0 10px 24px rgba(54, 41, 77, 0.12);
}

.hf-saved-template p {
  margin: 0;
  color: #716b79;
  font-size: 11px;
}

.hf-saved-template strong {
  font-size: 14px;
}

.hf-saved-template span {
  color: #716b79;
  font-size: 11px;
}

.hf-saved-template a {
  width: fit-content;
  border-radius: 4px;
  padding: 6px 9px;
  background: #6541b2;
  color: #fff;
  font-size: 11px;
  text-decoration: none;
}

.hf-template-summary {
  left: 21.5%;
  top: 80.5%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #d8caeb;
  border-radius: 6px;
  padding: 6px 8px 6px 10px;
  background: rgba(255, 255, 255, 0.96);
  color: #514b59;
  font-size: 11px;
  box-shadow: 0 6px 16px rgba(54, 41, 77, 0.1);
}

.hf-template-summary.result {
  top: 78.5%;
}

.hf-template-summary button,
.hf-template-summary a {
  border: 0;
  border-radius: 4px;
  padding: 5px 8px;
  background: #6541b2;
  color: #fff;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.hf-template-choice-highlight {
  top: 33%;
  width: 11.5%;
  height: 20%;
  border: 3px solid #6541b2;
  border-radius: 8px;
  background: rgba(101, 65, 178, 0.05);
  box-shadow: 0 0 0 3px rgba(101, 65, 178, 0.12);
  pointer-events: none;
}

.hf-template-progress {
  z-index: 8;
}

.hf-template-toast {
  top: 7.5%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 72%;
  border: 1px solid #b9d7c0;
  border-radius: 6px;
  padding: 9px 14px;
  background: #f2fbf4;
  color: #2f6b3c;
  font-size: 12px;
  box-shadow: 0 10px 22px rgba(39, 74, 48, 0.16);
}

@keyframes hf-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .hf-root {
    padding: 0;
    place-items: start center;
  }

  .hf-stage {
    width: 100vw;
  }

  .hf-ai-live {
    left: 16%;
    width: 68%;
    padding: 12px;
  }

  .hf-ai-result-panel {
    top: 14%;
    right: 2%;
    width: 42%;
    max-height: 70%;
    padding: 10px;
  }

  .hf-ai-result-panel p,
  .hf-ai-result-panel dd,
  .hf-ai-live p {
    font-size: 10px;
  }

  .hf-ai-result-panel h3,
  .hf-ai-live strong {
    font-size: 13px;
  }

  .hf-ai-panel-actions {
    flex-wrap: wrap;
  }

  .hf-template-summary {
    max-width: 54%;
    padding: 4px;
    font-size: 9px;
  }

  .hf-template-summary button,
  .hf-template-summary a {
    padding: 4px 6px;
  }

  .hf-template-editor {
    width: 92%;
    max-height: 94%;
    gap: 8px;
    padding: 14px;
  }

  .hf-saved-template {
    right: 2%;
    width: 30%;
    padding: 8px;
  }
}
