:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft: #f9fafb;
  --accent: #111827;
  --blue: #2563eb;
  --green: #15803d;
  --red: #b91c1c;
  --radius: 14px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

/* Header and navigation */

.site-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.header-inner {
  width: min(1120px, calc(100% - 40px));
  min-height: 72px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 30px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: 190px;
  max-width: 100%;
  height: auto;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
}

.top-nav a,
.site-footer a {
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
}

.top-nav a:hover,
.site-footer a:hover {
  color: #111827;
}

/* Product introduction */

.page-intro {
  padding: 56px 0 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .13em;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.15;
  letter-spacing: -.045em;
}

.intro-copy {
  max-width: 760px;
  margin: 16px 0 18px;
  color: #4b5563;
  font-size: 17px;
}

.trust-points {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: #4b5563;
  font-size: 13px;
}

.trust-points i {
  margin-right: 5px;
  color: var(--green);
  font-style: normal;
  font-weight: 800;
}

/* Shared buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}

.button:disabled {
  opacity: .42;
}

.button-primary {
  color: #fff;
  background: #111827;
}

.button-primary:hover:not(:disabled) {
  background: #293548;
}

.button-secondary {
  color: #111827;
  background: #fff;
  border-color: #d1d5db;
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  background: #f3f4f6;
}

.button-quiet {
  color: #4b5563;
  background: transparent;
  border-color: var(--line);
}

.danger-text {
  color: var(--red);
}

/* Main tool area */

.tool-section {
  padding-bottom: 56px;
}

.upload-panel {
  min-height: 260px;
  padding: 30px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  border: 1.5px dashed #cbd5e1;
  border-radius: 16px;
  background: #fafbfc;
  transition: border-color .15s, background .15s;
}

.upload-panel.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}

.upload-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eef2f7;
}

.upload-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #374151;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-panel h2 {
  margin: 0 0 2px;
  font-size: 18px;
}

.upload-panel p {
  margin: 2px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.choose-button {
  cursor: pointer;
}

.format-note {
  margin: 12px 0 0 !important;
  font-size: 12px !important;
}

/* Privacy note */

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0 30px;
  padding: 14px 16px;
  border: 1px solid #dcfce7;
  border-radius: 11px;
  background: #f0fdf4;
}

.privacy-icon {
  font-size: 17px;
}

.privacy-note p {
  margin: 0;
  color: #365744;
  font-size: 13px;
}

.privacy-note strong {
  color: #14532d;
}

/* Shared panel headings */

.workspace-panel,
.presets-panel,
.settings-panel,
.generate-panel,
.results-panel {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2,
.content-section h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.workspace-actions,
.preset-selection-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-actions .button,
.preset-selection-actions .button {
  min-height: 36px;
  padding: 7px 12px;
}

/* Source image information */

.source-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fafafa;
}

.source-thumb {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f3f4f6;
}

.source-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.source-details {
  min-width: 0;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.source-details strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Image previews */

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 20px;
}

.source-panel,
.output-preview-panel {
  min-width: 0;
}

.compact-heading {
  margin-bottom: 10px;
}

.compact-heading h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -.01em;
}

.compact-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.image-preview-box {
  position: relative;
  min-height: 270px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #e9edf2 25%, transparent 25%),
    linear-gradient(-45deg, #e9edf2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e9edf2 75%),
    linear-gradient(-45deg, transparent 75%, #e9edf2 75%);
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  background-size: 18px 18px;
}

.source-preview img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.output-preview {
  padding: 12px;
}

.output-preview canvas {
  display: block;
  max-width: 100%;
  max-height: 360px;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 2px 12px rgba(15, 23, 42, .12);
}

.preview-placeholder {
  max-width: 230px;
  padding: 12px;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

.preview-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 20px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 10px;
  font-weight: 700;
}

.preview-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

/* Preset groups */

.preset-group {
  margin-top: 24px;
}

.preset-group-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 11px;
}

.preset-group-heading h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -.01em;
}

.preset-group-heading span {
  color: var(--muted);
  font-size: 11px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.preset-card {
  position: relative;
  min-width: 0;
  min-height: 90px;
  padding: 13px 36px 12px 13px;
  display: flex;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.preset-card:hover {
  border-color: #cbd5e1;
  background: #fafafa;
}

.preset-card:has(input:checked) {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 0 0 1px #dbeafe;
}

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

.preset-card:focus-within {
  outline: 2px solid #bfdbfe;
  outline-offset: 2px;
}

.preset-card-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.preset-card-main strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
}

.preset-card-main > span {
  color: #374151;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.preset-card-main small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.preset-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  color: transparent;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.preset-card:has(input:checked) .preset-check {
  border-color: #2563eb;
  color: #fff;
  background: #2563eb;
}

/* Custom dimensions */

.custom-size-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.field-label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: #374151;
  font-size: 12px;
  font-weight: 650;
}

.input-with-unit {
  width: 150px;
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.input-with-unit input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 7px 9px;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.input-with-unit span {
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.checkbox-control {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #4b5563;
  font-size: 12px;
}

.checkbox-control input {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}

.custom-size-controls > .button {
  min-height: 40px;
}

.custom-preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.custom-preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 11px;
}

.custom-preset-chip button {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #1e40af;
  font-size: 15px;
}

.custom-preset-chip button:hover {
  background: #dbeafe;
}

.field-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

/* Image settings */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 22px;
  margin-top: 20px;
}

.settings-grid select {
  width: 100%;
  min-height: 40px;
  padding: 8px 30px 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.range-field {
  min-width: 0;
}

.range-field .field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.range-field output {
  color: #4b5563;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.range-field input[type="range"] {
  width: 100%;
  margin: 12px 0 0;
  accent-color: #2563eb;
  cursor: pointer;
}

.color-field input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 4px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}

.quality-field {
  grid-column: 1 / -1;
}

.settings-note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 9px;
  background: #f9fafb;
  color: #6b7280;
  font-size: 12px;
}

/* Generate actions and progress */

.generate-panel {
  background: #fafafa;
}

.generate-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.generate-summary > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

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

.generate-summary span {
  color: var(--muted);
  font-size: 12px;
}

.generate-summary .generate-limit {
  flex: 0 0 auto;
  font-size: 11px;
  text-align: right;
}

.generate-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.generate-progress .progress-track {
  flex: 1;
  height: 7px;
  margin: 0;
  overflow: hidden;
  border-radius: 20px;
  background: #e5e7eb;
}

.generate-progress .progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 20px;
  background: #2563eb;
  transition: width .2s;
}

.generate-progress > span {
  min-width: 38px;
  color: #4b5563;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.generate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* Generated results */

.results-heading {
  align-items: center;
}

.empty-results {
  padding: 30px 12px;
  color: #9ca3af;
  font-size: 13px;
  text-align: center;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.result-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.result-card-preview {
  height: 175px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #e9edf2 25%, transparent 25%),
    linear-gradient(-45deg, #e9edf2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e9edf2 75%),
    linear-gradient(-45deg, transparent 75%, #e9edf2 75%);
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  background-size: 18px 18px;
}

.result-card-preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .1);
}

.result-card-body {
  padding: 12px;
}

.result-card-title {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
}

.result-card-dimensions {
  margin-top: 3px;
  color: #4b5563;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.result-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.result-card-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
}

.result-card-actions .button {
  flex: 1;
  min-width: 0;
  min-height: 35px;
  padding: 7px 9px;
  font-size: 11px;
}

/* How-to, FAQ and related tools */

.content-section {
  padding: 10px 0 60px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 46px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

.content-grid p,
.content-grid li,
.faq-section p {
  color: #4b5563;
  font-size: 14px;
}

.content-grid ol {
  padding-left: 20px;
}

.content-grid li {
  padding: 4px 0;
}

.faq-section {
  max-width: 860px;
}

.faq-section h2 {
  margin-bottom: 12px;
}

.faq-section details {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

.faq-section p {
  margin: 8px 0 2px;
}

.related-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f9fafb;
}

.related-inner {
  padding: 30px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.related-inner h2 {
  margin: 0 0 5px;
  font-size: 20px;
  letter-spacing: -.02em;
}

.related-inner p:not(.eyebrow) {
  margin: 0;
  color: #4b5563;
  font-size: 13px;
}

.related-inner .eyebrow {
  margin-bottom: 5px;
}

.related-actions {
  width: min(100%, 540px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
}

.related-actions .button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  text-align: center;
  white-space: normal;
}

/* Footer and toast */

.site-footer {
  padding: 24px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: #9ca3af;
  font-size: 12px;
}

.footer-inner nav {
  display: flex;
  gap: 18px;
}

.site-footer a {
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 22px;
  max-width: min(90vw, 520px);
  padding: 10px 15px;
  transform: translate(-50%, 14px);
  border-radius: 9px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* Tablet layout */

@media (max-width: 900px) {
  .related-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preset-grid,
  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid {
    gap: 12px;
  }

  .image-preview-box {
    min-height: 230px;
  }
}

@media (max-width: 800px) {
  .header-inner {
    min-height: 0;
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .top-nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 18px;
  }

  .page-intro {
    padding: 40px 0 24px;
  }

  .intro-copy {
    font-size: 15px;
  }

  .trust-points {
    gap: 8px 16px;
  }

  .workspace-panel,
  .presets-panel,
  .settings-panel,
  .generate-panel,
  .results-panel {
    padding: 16px;
  }

  .workspace-heading {
    display: block;
  }

  .workspace-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .content-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .related-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Mobile layout */

@media (max-width: 520px) {
  .container,
  .header-inner {
    width: calc(100% - 28px);
  }

  .brand-logo {
    width: 155px;
  }

  .top-nav a {
    font-size: 12px;
  }

  .page-intro h1 {
    font-size: 34px;
  }

  .upload-panel {
    min-height: 235px;
    padding: 24px 14px;
  }

  .section-heading {
    gap: 12px;
  }

  .preset-selection-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .presets-panel > .section-heading {
    display: block;
  }

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

  .preset-card {
    min-height: 78px;
  }

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

  .image-preview-box {
    min-height: 220px;
  }

  .source-preview img,
  .output-preview canvas {
    max-height: 300px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .quality-field {
    grid-column: auto;
  }

  .custom-size-controls {
    align-items: stretch;
  }

  .input-with-unit {
    width: 100%;
  }

  .custom-size-controls > .field-label {
    flex: 1 1 calc(50% - 8px);
  }

  .custom-size-controls > .checkbox-control {
    flex-basis: 100%;
  }

  .custom-size-controls > .button {
    width: 100%;
  }

  .generate-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .generate-summary .generate-limit {
    text-align: left;
  }

  .generate-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .generate-actions .button {
    width: 100%;
  }

  .results-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .results-heading > .button {
    width: 100%;
  }

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

  .result-card-preview {
    height: 210px;
  }

  .related-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .related-actions .button {
    width: 100%;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .footer-inner nav {
    flex-wrap: wrap;
    gap: 10px 18px;
  }
}
