:root {
  color-scheme: light;
  --paper: #f6f1e8;
  --paper-strong: #fffdf9;
  --ink: #213337;
  --ink-soft: rgba(33, 51, 55, 0.72);
  --line: rgba(33, 51, 55, 0.12);
  --line-strong: rgba(33, 51, 55, 0.22);
  --sage: #dde5dc;
  --sage-strong: #cbd8cc;
  --accent: #324f47;
  --warning: #8f5b2f;
  --danger: #8e3b36;
  --success: #305743;
  --shadow: 0 18px 40px rgba(33, 51, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(221, 229, 220, 0.85), transparent 36%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.5), transparent 28%),
    linear-gradient(180deg, #f9f4ec 0%, #f4ede2 100%);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 32px;
}

.hero {
  padding: 16px 0 28px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.eyebrow,
.section-label,
.mode-step {
  margin: 0;
  color: rgba(33, 51, 55, 0.56);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow {
  margin-top: 22px;
}

h1,
h2,
h3,
strong {
  color: var(--ink);
}

h1 {
  max-width: 620px;
  margin: 8px 0 10px;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 600;
  line-height: 0.95;
}

h2 {
  margin: 6px 0 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 600;
  line-height: 1.02;
}

h3 {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.06;
}

.hero-copy,
.privacy-copy,
.support-copy,
.field-note,
.summary-empty,
.warning-panel,
.meta-panel,
.summary-item dd {
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.65;
}

.hero-copy {
  max-width: 700px;
  margin: 14px 0 0;
  font-size: 22px;
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.hero-notes span {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
}

.mode-picker,
.workspace {
  margin-top: 18px;
}

.section-heading,
.workspace-header {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
}

.privacy-copy {
  max-width: 340px;
  margin: 0;
  font-size: 16px;
}

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

.mode-card {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.mode-card strong {
  font-size: 24px;
  line-height: 1.08;
}

.mode-card span:last-child {
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.5;
}

.mode-card:hover,
.mode-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(50, 79, 71, 0.38);
  box-shadow: var(--shadow);
  outline: none;
}

.mode-card.is-active {
  border-color: rgba(50, 79, 71, 0.44);
  background: rgba(221, 229, 220, 0.72);
  box-shadow: var(--shadow);
}

.workspace {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 253, 249, 0.82);
  box-shadow: var(--shadow);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 26px;
  margin-top: 24px;
}

.controls-pane,
.preview-pane {
  min-width: 0;
}

.stack-block + .stack-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.upload-drop {
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px dashed rgba(50, 79, 71, 0.34);
  border-radius: 24px;
  background: rgba(221, 229, 220, 0.26);
  cursor: pointer;
}

.upload-drop input {
  display: none;
}

.upload-title {
  font-size: 24px;
  line-height: 1.1;
}

.upload-copy {
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
}

.meta-panel {
  margin-top: 14px;
  padding-left: 16px;
  border-left: 3px solid rgba(50, 79, 71, 0.28);
  font-size: 16px;
}

.meta-panel.is-muted {
  color: rgba(33, 51, 55, 0.58);
}

.mode-form.is-hidden,
.is-hidden {
  display: none !important;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-grid--single {
  grid-template-columns: 1fr;
}

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

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

.field span {
  color: var(--ink);
  font-size: 16px;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 17px;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(50, 79, 71, 0.24);
  outline-offset: 1px;
}

.field input[type="range"] {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  appearance: none;
}

.field input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(50, 79, 71, 0.18);
}

.field input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.field input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(50, 79, 71, 0.18);
}

.field input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.field-note {
  margin: 12px 0 0;
  font-size: 15px;
}

.toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 14px;
}

.toggle input {
  inline-size: 18px;
  block-size: 18px;
}

.swap-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  cursor: pointer;
}

.swap-button {
  align-self: end;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

.download-button {
  min-height: 56px;
  background: var(--accent);
  border-color: var(--accent);
  color: #f6f1e8;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.download-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: rgba(33, 51, 55, 0.58);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-card,
.summary-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.72);
}

.summary-card {
  margin-top: 18px;
}

.crop-adjust-card p {
  margin: 0 0 16px;
}

.crop-adjust-card .field + .field {
  margin-top: 16px;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 460px;
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 241, 232, 0.9)),
    repeating-linear-gradient(
      45deg,
      rgba(221, 229, 220, 0.18) 0,
      rgba(221, 229, 220, 0.18) 12px,
      transparent 12px,
      transparent 24px
    );
  overflow: hidden;
}

#previewCanvas {
  max-width: 100%;
  max-height: 540px;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(33, 51, 55, 0.12);
}

.preview-placeholder {
  position: absolute;
  inset: auto 36px 32px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink-soft);
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
}

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

.quality-badge {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(221, 229, 220, 0.45);
  color: var(--ink-soft);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quality-badge.is-good {
  background: rgba(48, 87, 67, 0.12);
  color: var(--success);
}

.quality-badge.is-warn {
  background: rgba(143, 91, 47, 0.14);
  color: var(--warning);
}

.quality-badge.is-danger {
  background: rgba(142, 59, 54, 0.14);
  color: var(--danger);
}

.summary-list {
  display: grid;
  gap: 14px;
}

.summary-item {
  display: grid;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.summary-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.summary-item dt {
  color: rgba(33, 51, 55, 0.58);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.summary-item dd {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.45;
}

.warning-panel {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(143, 91, 47, 0.22);
  background: rgba(143, 91, 47, 0.08);
  color: var(--warning);
  font-size: 16px;
}

.warning-panel.is-danger {
  border-color: rgba(142, 59, 54, 0.22);
  background: rgba(142, 59, 54, 0.08);
  color: var(--danger);
}

.app-footer {
  display: flex;
  justify-content: center;
  padding: 22px 0 6px;
}

.app-footer a {
  color: var(--ink-soft);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.download-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  gap: 14px;
  align-items: start;
  max-width: 420px;
  padding: 18px 18px 18px 20px;
  border: 1px solid rgba(50, 79, 71, 0.2);
  border-radius: 22px;
  background: rgba(255, 253, 249, 0.98);
  box-shadow: 0 20px 40px rgba(33, 51, 55, 0.12);
  z-index: 20;
}

.download-toast__content strong {
  display: block;
  margin-bottom: 6px;
  font-size: 20px;
  line-height: 1.15;
}

.download-toast__content p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
}

.download-toast__close {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  cursor: pointer;
}

@media (max-width: 980px) {
  .section-heading,
  .workspace-header,
  .workspace-grid,
  .mode-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .workspace-grid {
    gap: 20px;
  }

  .privacy-copy {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 20px 16px 28px;
  }

  .hero {
    padding: 8px 0 20px;
  }

  .eyebrow {
    margin-top: 18px;
  }

  h1 {
    max-width: none;
    font-size: clamp(34px, 10vw, 46px);
    line-height: 1.02;
  }

  h2 {
    font-size: 29px;
  }

  h3 {
    font-size: 22px;
  }

  .hero-copy,
  .privacy-copy,
  .support-copy,
  .field-note,
  .summary-empty,
  .warning-panel,
  .meta-panel,
  .summary-item dd {
    font-size: 16px;
    line-height: 1.55;
  }

  .hero-copy {
    margin-top: 12px;
    font-size: 18px;
  }

  .section-heading,
  .workspace-header {
    gap: 12px;
  }

  .mode-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(260px, 84vw);
    overflow-x: auto;
    gap: 12px;
    margin-top: 18px;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .mode-grid::-webkit-scrollbar {
    display: none;
  }

  .mode-card {
    gap: 8px;
    padding: 16px;
    border-radius: 20px;
    scroll-snap-align: start;
  }

  .mode-card strong {
    font-size: 20px;
  }

  .mode-card span:last-child {
    font-size: 15px;
    line-height: 1.45;
  }

  .workspace {
    padding: 18px 16px;
    border-radius: 22px;
  }

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

  .stack-block + .stack-block {
    margin-top: 22px;
    padding-top: 20px;
  }

  .upload-drop {
    padding: 18px;
    border-radius: 20px;
  }

  .upload-title {
    font-size: 20px;
  }

  .upload-copy,
  .field span,
  .toggle,
  .warning-panel {
    font-size: 15px;
  }

  .field input,
  .field select {
    padding: 13px 14px;
    font-size: 16px;
  }

  .swap-button,
  .download-button {
    width: 100%;
  }

  .preview-card,
  .summary-card {
    padding: 16px;
    border-radius: 22px;
  }

  .preview-stage {
    min-height: 280px;
    padding: 12px;
  }

  #previewCanvas {
    max-height: 300px;
  }

  .preview-placeholder {
    inset: auto 14px 14px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
  }

  .summary-header {
    align-items: start;
    flex-direction: column;
  }

  .download-toast {
    right: 16px;
    left: 16px;
    bottom: 16px;
    max-width: none;
    padding: 16px;
    border-radius: 18px;
  }

  .download-toast__content strong {
    font-size: 18px;
  }

  .download-toast__content p {
    font-size: 14px;
  }

  .app-footer {
    padding: 18px 0 4px;
  }
}
