:root {
  color-scheme: light;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1a2a25;
  background: #f2f6f4;
  font-synthesis: none;
  --ink: #1a2a25;
  --muted: #546861;
  --line: #d9e4df;
  --accent: #16654f;
  --accent-dark: #104d3d;
  --accent-soft: #e3f2ea;
  --surface: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
button, input { font: inherit; }
button { color: inherit; }
button:not(:disabled), label:has(input:not(:disabled)) { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, p { margin: 0; }

.page-width {
  width: min(100% - 48px, 1152px);
  margin-inline: auto;
}

.site-header {
  background: #fafcfb;
  border-bottom: 1px solid #dfe9e3;
}

.header-inner {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 720;
  font-size: 1rem;
  white-space: nowrap;
}

.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-content: center;
  grid-template-columns: repeat(2, 7px);
  grid-auto-rows: 7px;
  gap: 3px;
  border-radius: 10px;
  background: #194c3e;
}
.brand-mark i { border-radius: 2px; background: #a9dbc2; }
.brand-mark i:nth-child(2) { background: #f2fbf5; }
.brand-mark i:nth-child(3) { background: #70b797; }

.privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.lock-icon {
  position: relative;
  width: 12px;
  height: 10px;
  margin-top: 4px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.lock-icon::before {
  position: absolute;
  content: "";
  width: 7px;
  height: 6px;
  inset: -6px 0 auto;
  margin-inline: auto;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.main-content { padding-block: 54px 64px; }
.intro { margin-bottom: 34px; }
.intro h1 {
  margin-bottom: 11px;
  font-size: clamp(2.35rem, 4.6vw, 4rem);
  font-weight: 770;
  line-height: 1.12;
  letter-spacing: -0.055em;
}
.intro p {
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  align-items: start;
  gap: 20px;
}
.card {
  min-width: 0;
  padding: 24px;
  border: 1px solid #dce6e1;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 5px 24px #132b2110;
}
.card h2 {
  color: var(--ink);
  font-size: 1.1875rem;
  font-weight: 710;
  line-height: 1.35;
}

.preview-heading {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}
.drop-zone {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 350px;
  display: grid;
  border: 1px dashed #aac2b7;
  border-radius: 16px;
  overflow: hidden;
  background: radial-gradient(circle, #dce9e1 1px, transparent 1px) 0 0 / 18px 18px, #f7fbf8;
}
.empty-state {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 15px;
  min-height: 350px;
  padding: 24px 15px;
}
.empty-state strong { font-size: 1.0625rem; font-weight: 660; }
.upload-glyph {
  position: relative;
  display: grid;
  place-items: center;
  margin: 3px 0 5px;
  width: 66px;
  height: 66px;
  border: 1px solid #c4e1d2;
  border-radius: 19px;
  background: #e8f4ed;
}
.upload-glyph span {
  position: relative;
  width: 28px;
  height: 25px;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
}
.upload-glyph span::before, .upload-glyph span::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  background: var(--accent);
  border-radius: 2px;
}
.upload-glyph span::before { width: 12px; height: 1.5px; }
.upload-glyph span::after { width: 1.5px; height: 12px; }

.checkerboard {
  background: conic-gradient(#e7eeeb 25%, #f8faf9 0 50%, #e7eeeb 0 75%, #f8faf9 0) 0 0 / 24px 24px;
}
.image-stage {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  height: 350px;
  min-width: 0;
  padding: 14px;
  overflow: hidden;
}
.image-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 11px #24383117);
}
.image-stage canvas.sampling { cursor: crosshair; }
.drop-overlay {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: none;
  place-items: center;
  pointer-events: none;
  color: var(--accent-dark);
  font-size: 1.125rem;
  font-weight: 680;
  background: #e3f2e9ee;
}
.drop-zone.dragging { border-color: var(--accent); }
.drop-zone.dragging .drop-overlay { display: grid; }

.file-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
}
.file-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.format-label {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 38px;
  border: 1px solid #d3e5dc;
  border-radius: 9px;
  color: var(--accent-dark);
  background: #eff6f2;
  font-weight: 720;
  font-size: 0.75rem;
}
.file-text { display: grid; gap: 3px; min-width: 0; }
.file-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 660;
}
.file-text span, .preview-note { color: var(--muted); font-size: 0.8125rem; }
.file-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.preview-note { line-height: 1.5; margin-top: 10px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 7px 15px;
  background: transparent;
  font-size: 0.875rem;
  font-weight: 660;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease;
}
.button-soft { color: var(--accent-dark); background: var(--accent-soft); border-color: #c9e6d6; }
.button-soft:hover { background: #d5eadf; border-color: #afdbc6; }
.button-plain { min-height: 36px; padding-inline: 8px; color: var(--accent-dark); }
.button-plain:not(:disabled):hover { background: #edf5f0; }
.button-plain:disabled { color: var(--muted); opacity: 0.72; }
.button-primary {
  width: 100%;
  min-height: 49px;
  color: white;
  background: var(--accent);
  font-size: 1rem;
}
.button-primary:not(:disabled):hover { background: var(--accent-dark); }
.button-primary:disabled { background: #e0eae4; color: #496057; }

.settings-card { display: grid; gap: 23px; }
.settings-card h2 { margin-top: 6px; }
.setting {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.setting legend, .range-title label {
  padding: 0;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 660;
}
.segments {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid #e3ebe7;
  border-radius: 11px;
  background: #f1f6f3;
}
.segments button, .format-options label span {
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #4b6259;
  background: transparent;
  font-size: 0.875rem;
}
.format-options label { position: relative; }
.format-options input, .switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
}
.format-options label span { min-height: 40px; font-weight: 690; }
.view-tabs button { min-width: 53px; min-height: 30px; padding: 0 7px; font-weight: 620; }
.segments button[aria-pressed="true"], .format-options input:checked + span {
  color: var(--accent-dark);
  background: white;
  border-color: #d9e6df;
  box-shadow: 0 1px 3px #18382c12;
}
.format-options input:focus-visible + span, .switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.range-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.range-title label { margin-bottom: 2px; }
.range-title output { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
input[type="range"] { display: block; width: 100%; height: 27px; margin: 1px 0 0; accent-color: var(--accent); }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding-block: 4px;
  font-size: 0.875rem;
}
.switch { position: relative; display: inline-flex; flex-shrink: 0; width: 39px; height: 24px; }
.switch-track { width: 100%; height: 100%; border-radius: 99px; background: #d2dfd9; transition: background 150ms ease; }
.switch-track::before {
  position: absolute;
  content: "";
  width: 18px;
  height: 18px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: white;
  transition: translate 150ms ease;
  box-shadow: 0 1px 3px #18382c2e;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::before { translate: 15px; }

.background-options, .fill-setting {
  margin-top: 9px;
  padding: 11px 12px;
  border: 1px solid #e2ebe6;
  border-radius: 12px;
  background: #f6f9f7;
}
.color-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  margin-bottom: 9px;
}
.color-label, .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  line-height: 1.35;
}
input[type="color"] {
  appearance: none;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 3px;
  border: 1px solid #baccc3;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch, input[type="color"]::-moz-color-swatch { border: 0; border-radius: 4px; }
.sample-button { padding-inline: 5px; }
.sample-button[aria-pressed="true"] { border-color: #c1e0cf; background: var(--accent-soft); }
.check-row { margin-top: 8px; min-height: 25px; }
.check-row input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.fill-setting p {
  margin-block: 6px 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.55;
}
.settings-actions { padding-top: 3px; }
.status {
  min-height: 1.3em;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.status[data-kind="error"] { color: #a02b25; }
.status[data-kind="success"] { color: var(--accent-dark); }
.noscript { margin-top: 16px; color: #a02b25; }

@media (max-width: 820px) {
  .main-content { padding-block: 38px 44px; }
  .intro { margin-bottom: 24px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .drop-zone, .empty-state { min-height: 280px; }
  .image-stage { height: 280px; }
}
@media (max-width: 480px) {
  .page-width { width: calc(100% - 32px); }
  .header-inner { min-height: 62px; }
  .privacy { font-size: 0.8125rem; gap: 6px; }
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .card { border-radius: 17px; padding: 16px; }
  .preview-heading { margin-bottom: 10px; }
  .drop-zone, .empty-state { min-height: 224px; }
  .image-stage { height: 224px; padding: 11px; }
  .settings-card { gap: 17px; }
  .button-plain { padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
