:root {
  color-scheme: light;
  --bg: #f6f2ec;
  --surface: #ffffff;
  --surface-soft: #faf7f2;
  --ink: #171717;
  --muted: #707070;
  --line: #e7dfd5;
  --accent: #9a5a34;
  --accent-strong: #6f3b22;
  --accent-soft: #f5ebe2;
  --success: #226348;
  --shadow: 0 16px 44px rgba(40, 30, 20, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
a {
  font: inherit;
}

input {
  min-width: 0;
}

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

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0;
}

h2,
p {
  margin-top: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.controls,
.preview-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 18px 0 10px;
}

.section-title:first-child {
  margin-top: 0;
}

.section-title span {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 132px;
  place-items: center;
  padding: 18px;
  border: 1px dashed #cdbbaa;
  border-radius: 18px;
  background: var(--surface-soft);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--accent);
  font-size: 1.25rem;
  font-weight: 800;
}

.drop-zone strong,
.drop-zone small {
  display: block;
}

.drop-zone strong {
  font-size: 0.95rem;
}

.drop-zone small,
.file-name,
.status,
.watermark-ready p {
  color: var(--muted);
}

.drop-zone small {
  margin-top: 4px;
  font-size: 0.78rem;
}

.file-name {
  margin: 8px 0 0;
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.drive-box label {
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.35;
}

.drive-box small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.drive-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.drive-row input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface-soft);
  outline: none;
}

.drive-row input:focus {
  border-color: var(--accent);
  background: #fff;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.field span {
  font-size: 0.9rem;
  font-weight: 700;
}

.field output {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
}

.field input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--accent);
}

.position-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
}

.position-picker legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.position-picker label {
  display: flex;
  min-height: 36px;
  gap: 8px;
  align-items: center;
  color: #4c4c4c;
  font-size: 0.84rem;
  line-height: 1.25;
}

.position-picker input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 18px;
}

button,
.download {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

button:hover,
.download:hover {
  transform: translateY(-1px);
}

button:disabled,
.download.disabled {
  cursor: not-allowed;
  opacity: 0.48;
  pointer-events: none;
}

.primary,
.download {
  display: inline-grid;
  place-items: center;
  padding: 12px 16px;
  color: #fff;
  background: var(--accent-strong);
}

.secondary {
  padding: 12px 16px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.status {
  min-height: 21px;
  margin: 12px 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
}

.preview-panel {
  display: grid;
  min-height: calc(100vh - 44px);
  grid-template-rows: auto 1fr;
}

.preview-header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.preview-header .eyebrow {
  margin-bottom: 4px;
}

.results-wrap {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #f1eee9 25%, transparent 25%),
    linear-gradient(-45deg, #f1eee9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1eee9 75%),
    linear-gradient(-45deg, transparent 75%, #f1eee9 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  padding: 14px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(20, 20, 20, 0.08);
}

.result-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background:
    linear-gradient(45deg, #f3f0eb 25%, transparent 25%),
    linear-gradient(-45deg, #f3f0eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f0eb 75%),
    linear-gradient(-45deg, transparent 75%, #f3f0eb 75%);
  background-color: #fff;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-size: 14px 14px;
}

.result-meta {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.result-meta strong {
  overflow: hidden;
  font-size: 0.82rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-download {
  min-height: 38px;
  padding: 9px 12px;
  font-size: 0.86rem;
}

.empty-state {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  gap: 6px;
  max-width: 320px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 1rem;
}

.empty-state span {
  font-size: 0.86rem;
  line-height: 1.5;
}

.empty-state.hidden {
  display: none;
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 24px, 1120px);
    padding: 12px 0;
  }

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

  .preview-panel {
    min-height: 520px;
  }

  .results-wrap {
    min-height: 420px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 18px, 1120px);
    padding: 8px 0 12px;
  }

  .workspace {
    gap: 10px;
  }

  .panel {
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(40, 30, 20, 0.07);
  }

  .controls,
  .preview-panel {
    padding: 12px;
  }

  .drop-zone {
    min-height: 112px;
    padding: 14px;
  }

  .section-title {
    margin: 14px 0 8px;
  }

  .position-picker {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .actions,
  .drive-row,
  .preview-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .preview-panel {
    min-height: 430px;
  }

  .results-wrap {
    min-height: 300px;
    border-radius: 16px;
  }

  .results-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
}
