:root {
  color-scheme: light;
  --canvas: #f4f5f2;
  --panel: #fbfcfa;
  --surface: #ffffff;
  --ink: #16212b;
  --muted: #75808a;
  --line: #dfe4e0;
  --navy: #12334f;
  --navy-dark: #0a2237;
  --orange: #e76b30;
  --teal: #117d78;
  --soft-blue: #eaf1f4;
  --soft-orange: #fff0e6;
  --shadow: 0 18px 45px rgba(16, 31, 43, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(18, 51, 79, 0.025) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--canvas);
  font-family: Inter, "Segoe UI", Arial, "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(231, 107, 48, 0.25);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 352px minmax(0, 1fr);
  min-height: 100vh;
}

.control-panel {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 24px 24px 22px;
  background: rgba(251, 252, 250, 0.94);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--navy);
  border-radius: 12px 12px 12px 4px;
  box-shadow: 0 9px 20px rgba(18, 51, 79, 0.18);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-top: 4px;
  color: var(--navy);
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin-top: 4px;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.14em;
  line-height: 1.2;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid #bfe2da;
  border-radius: 999px;
  color: var(--teal);
  background: #eff9f5;
  font-size: 10px;
  font-weight: 850;
}

.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3aad74;
  box-shadow: 0 0 0 3px rgba(58, 173, 116, 0.12);
}

.control-form {
  display: grid;
  gap: 17px;
  margin-top: 28px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.field-heading > span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.field-heading small {
  color: var(--muted);
  font-size: 10px;
}

input {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  color: var(--ink);
  background: #fff;
}

input::placeholder {
  color: #a9b0b4;
}

input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(231, 107, 48, 0.12);
}

.style-upload {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1.35 / 1;
  overflow: hidden;
  border: 1.5px dashed #b9c1be;
  border-radius: 9px;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(17, 125, 120, 0.04), transparent 55%),
    #f4f6f3;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.style-upload:hover,
.style-upload.dragging {
  border-color: var(--orange);
  background: #fff9f5;
  transform: translateY(-1px);
}

.style-upload img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-upload.has-image img {
  display: block;
}

.style-upload.has-image:hover::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(10, 26, 39, 0.42);
  content: "点击更换样式图";
  font-size: 12px;
  font-weight: 800;
}

.style-upload.has-image .upload-placeholder {
  display: none;
}

.upload-placeholder {
  display: grid;
  place-items: center;
  gap: 7px;
  text-align: center;
}

.upload-placeholder b {
  color: var(--ink);
  font-size: 14px;
}

.upload-placeholder small {
  font-size: 10px;
}

.placeholder-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--orange);
  background: var(--soft-orange);
}

.image-action {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(15, 26, 36, 0.76);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.18s ease, transform 0.18s ease;
}

.image-action:hover,
.round-tool:hover {
  background: rgba(231, 107, 48, 0.92);
  transform: translateY(-1px);
}

.image-action svg {
  width: 16px;
  height: 16px;
}

.image-download {
  top: 10px;
  left: 10px;
}

.hidden {
  display: none !important;
}

.generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--orange);
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(231, 107, 48, 0.18);
  transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.generate-button:hover:not(:disabled) {
  background: #cd5723;
  transform: translateY(-1px);
}

.generate-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.generate-button svg {
  width: 18px;
  height: 18px;
}

.button-arrow {
  display: inline-grid;
  margin-left: auto;
}

.button-arrow svg {
  width: 16px;
  height: 16px;
}

.workspace {
  min-width: 0;
  padding: 28px 38px 56px;
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 23px;
  border-bottom: 1px solid var(--line);
}

.workspace-title {
  padding-top: 4px;
}

.workspace-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex: 0 0 auto;
}

.progress-panel {
  width: min(360px, 38vw);
  padding: 12px 14px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 25px rgba(16, 31, 43, 0.04);
}

.progress-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  font-weight: 750;
}

.progress-topline b {
  color: var(--orange);
}

.progress-track {
  height: 6px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e8e5;
}

.progress-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--teal));
  transition: width 0.25s ease;
}

.progress-panel p {
  margin-top: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zip-button {
  display: grid;
  place-items: center;
  align-self: stretch;
  width: 48px;
  min-width: 48px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--navy);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(18, 51, 79, 0.14);
  transition: background 0.18s ease, transform 0.18s ease;
}

.zip-button:hover:not(.disabled) {
  background: var(--navy-dark);
  transform: translateY(-1px);
}

.zip-button.disabled {
  pointer-events: none;
  opacity: 0.35;
  box-shadow: none;
}

.zip-button svg {
  width: 19px;
  height: 19px;
}

.gallery-section {
  padding-top: 29px;
}

.references-section {
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.count-badge {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 27px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--teal);
  background: #e5f1ed;
  font-size: 11px;
  font-weight: 850;
}

.output-count {
  color: var(--orange);
  background: #fff0e6;
}

.reference-grid,
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 13px;
}

.reference-card,
.result-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 7px 20px rgba(16, 31, 43, 0.05);
}

.reference-card .image-wrap,
.result-card .image-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e7ebe8;
}

.reference-card img,
.result-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.35s ease;
}

.reference-card:hover img,
.result-card:hover img {
  transform: scale(1.025);
}

.reference-card .card-foot,
.result-card .card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 39px;
  padding: 0 11px;
}

.card-foot span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-number {
  color: var(--ink) !important;
  font-weight: 850;
}

.card-download,
.card-remove {
  position: absolute;
  z-index: 2;
}

.card-download {
  top: 10px;
  left: 10px;
}

.card-remove {
  top: 10px;
  right: 10px;
}

.reference-upload-tile {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  min-height: 180px;
  border: 1.5px dashed #b9c1be;
  border-radius: 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.reference-upload-tile:hover,
.reference-upload-tile.dragging {
  border-color: var(--teal);
  color: var(--teal);
  background: #f2faf8;
}

.reference-upload-inner {
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
}

.reference-upload-inner b {
  color: var(--ink);
  font-size: 14px;
}

.reference-upload-inner small {
  max-width: 125px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.reference-upload-inner svg {
  width: 28px;
  height: 28px;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 190px;
  border: 1px dashed #c9d0cc;
  border-radius: 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
}

.empty-state svg {
  width: 25px;
  height: 25px;
  color: var(--orange);
}

.empty-state b {
  color: var(--ink);
  font-size: 14px;
}

.result-card.pending {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  min-height: 180px;
  color: var(--muted);
  background: #f9faf7;
}

.pending-inner {
  display: grid;
  place-items: center;
  gap: 10px;
  font-size: 11px;
}

.pending-inner svg {
  width: 24px;
  height: 24px;
  color: var(--teal);
  animation: breathe 1.4s ease-in-out infinite;
}

.result-card.failed {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 18px;
  color: #9c3520;
  background: #fff1ec;
  font-size: 11px;
  line-height: 1.5;
}

@keyframes breathe {
  50% {
    opacity: 0.32;
    transform: scale(0.8);
  }
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgba(5, 12, 18, 0.93);
}

.preview-modal.open {
  display: grid;
}

.preview-modal > img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  transform: scale(var(--zoom, 1));
  transition: transform 0.15s ease;
}

.round-tool {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(27, 36, 42, 0.74);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.18s ease, transform 0.18s ease;
}

.round-tool svg {
  width: 20px;
  height: 20px;
}

.modal-close {
  position: fixed;
  top: 18px;
  left: 18px;
}

.modal-tools {
  position: fixed;
  bottom: 24px;
  left: 50%;
  display: flex;
  gap: 11px;
  transform: translateX(-50%);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .control-panel {
    padding-right: 20px;
    padding-left: 20px;
  }

  .workspace {
    padding-right: 26px;
    padding-left: 26px;
  }

  .progress-panel {
    width: min(310px, 34vw);
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: relative;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .control-form {
    max-width: 620px;
  }

  .workspace {
    padding-top: 25px;
  }

  .progress-panel {
    width: min(420px, 55vw);
  }
}

@media (max-width: 620px) {
  .control-panel,
  .workspace {
    padding: 19px;
  }

  .brand-lockup {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .status-pill {
    grid-column: 2;
    justify-self: start;
    margin-top: -5px;
  }

  .workspace-header {
    flex-direction: column;
    gap: 18px;
  }

  .workspace-actions {
    width: 100%;
  }

  .progress-panel {
    width: 100%;
  }

  .zip-button {
    flex: 0 0 48px;
  }

  .reference-grid,
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card-foot {
    padding-right: 8px !important;
    padding-left: 8px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
