:root {
  --ink: #10201c;
  --muted: #64736e;
  --line: #dbe4e0;
  --soft: #f2f6f4;
  --accent: #176b57;
  --accent-hover: #0f5847;
  --danger: #a33a3a;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial,
    sans-serif;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid rgba(23, 107, 87, 0.25);
  outline-offset: 2px;
}

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.header-inner {
  width: min(1120px, calc(100% - 40px));
  min-height: 112px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.workspace {
  width: min(1120px, calc(100% - 40px));
  margin: 32px auto;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 24px;
  align-items: start;
}

.upload-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 24px;
}

.section-heading {
  min-height: 38px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.step {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.text-button {
  border: 0;
  padding: 7px 4px;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
}

.text-button:disabled {
  color: #a9b3af;
  cursor: default;
}

.drop-zone {
  min-height: 260px;
  border: 1px dashed #9aaba5;
  border-radius: 8px;
  background: #fbfcfc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #f5faf8;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.drop-zone strong {
  color: var(--ink);
  font-size: 15px;
}

.drop-zone span:last-child {
  font-size: 13px;
}

.upload-mark {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--white);
  font-size: 24px;
  line-height: 1;
}

.file-summary {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.file-summary[hidden] {
  display: none;
}

.file-summary img {
  width: 72px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: cover;
  background: var(--white);
}

.file-summary strong,
.file-summary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary strong {
  font-size: 14px;
}

.file-summary span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.quality-label {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 5px 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
}

.preview-wrap {
  margin-bottom: 18px;
}

.preview-wrap canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 523;
  border: 1px solid var(--line);
  border-radius: 4px;
  display: block;
  background: var(--white);
}

.preview-wrap p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.preset-list {
  border-top: 1px solid var(--line);
}

.preset-row {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.preset-row strong,
.preset-row span {
  display: block;
}

.preset-row strong {
  font-size: 15px;
}

.preset-row > div:first-child > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.status {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.status.is-error {
  color: var(--danger);
}

.download-button {
  min-width: 62px;
  height: 34px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--accent);
  background: var(--white);
  cursor: pointer;
}

.download-button:disabled {
  border-color: var(--line);
  color: #a9b3af;
  cursor: default;
}

.primary-button {
  width: 100%;
  height: 46px;
  margin-top: 20px;
  border: 0;
  border-radius: 6px;
  color: var(--white);
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.primary-button:disabled {
  background: #aebbb6;
  cursor: default;
}

.global-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

footer p {
  margin: 0;
}

@media (max-width: 820px) {
  .header-inner {
    min-height: 126px;
    padding: 20px 0;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }

  .privacy-note {
    text-align: left;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 190px;
  }
}

@media (max-width: 520px) {
  .header-inner,
  .workspace,
  footer {
    width: min(100% - 24px, 1120px);
  }

  h1 {
    font-size: 23px;
  }

  .workspace {
    margin-top: 18px;
    gap: 14px;
  }

  .upload-panel,
  .result-panel {
    padding: 18px;
  }

  .preset-row {
    min-height: 88px;
    align-items: flex-start;
    padding: 14px 0;
    flex-direction: column;
    gap: 10px;
  }

  .row-actions {
    width: 100%;
    justify-content: space-between;
  }
}
