:root {
  --bg: #f8f6f2;
  --surface: #ffffff;
  --text: #2f2f2f;
  --muted: #7a7a7a;
  --primary: #7c9a7a;
  --primary-soft: #dfe9dc;
  --border: #ebe7df;
  --border-strong: #dbd5ca;
  --accent: #f3eee4;
  --shadow-soft: 0 18px 50px rgba(59, 52, 46, 0.08);
  --shadow-card: 0 30px 80px rgba(59, 52, 46, 0.08);
  --shadow-lift: 0 24px 54px rgba(124, 154, 122, 0.14);
  --radius-xl: 36px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --container: 920px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Source Sans 3", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(223, 233, 220, 0.95), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.85), transparent 34%),
    linear-gradient(180deg, #fcfbf8 0%, var(--bg) 42%, #f7f4ee 100%);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(calc(100% - 1.5rem), var(--container));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.hero,
.main-flow {
  display: grid;
}

.hero {
  gap: 1rem;
  padding: 3rem 0 4rem;
  max-width: 720px;
}

.eyebrow,
.section-tag,
.section-label {
  margin: 0;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Nunito", sans-serif;
  color: var(--text);
}

h1 {
  max-width: 12ch;
  font-size: clamp(2.9rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero__lead,
.tool-card__header p,
.preview-note,
.upload-box__text,
.image-placeholder,
.stat__label,
.feedback,
.faq-list p,
.steps-list,
.footer p {
  color: var(--muted);
}

.hero__lead {
  max-width: 38ch;
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.55;
}

.main-flow {
  gap: 4rem;
}

.tool-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: clamp(1.4rem, 3vw, 2.5rem);
  backdrop-filter: blur(18px);
}

.tool-card__header {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 2.5rem;
  max-width: 580px;
}

.tool-card__header h2 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.tool-card__header p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.55;
}

.tool-section {
  display: grid;
  gap: 1rem;
}

.tool-section + .tool-section {
  margin-top: 3.25rem;
  padding-top: 3rem;
  border-top: 1px solid rgba(235, 231, 223, 0.82);
}

.section-heading {
  display: grid;
  gap: 0.45rem;
}

.section-heading--wide {
  margin-bottom: 1.35rem;
}

.upload-box {
  position: relative;
  display: grid;
  place-items: center;
  gap: 0.65rem;
  min-height: 300px;
  padding: 2rem;
  border-radius: 32px;
  border: 2px dashed var(--border-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(223, 233, 220, 0.38)),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  text-align: center;
  cursor: pointer;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background 220ms ease;
}

.upload-box:hover,
.upload-box:focus-within {
  transform: translateY(-4px);
  border-color: rgba(124, 154, 122, 0.65);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(223, 233, 220, 0.56)),
    var(--surface);
  box-shadow: var(--shadow-lift);
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.upload-box__icon {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: rgba(124, 154, 122, 0.12);
  color: var(--primary);
  font-size: 2.6rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.upload-box__title {
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text);
}

.upload-box__text {
  font-size: 1rem;
}

.status-area {
  min-height: 1.4rem;
}

.feedback {
  margin: 0;
  font-weight: 700;
}

.feedback--error {
  color: #b2645f;
}

.feedback--success {
  color: #628462;
}

.image-preview {
  overflow: hidden;
  min-height: 210px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(235, 231, 223, 0.95);
}

.image-preview img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.image-placeholder {
  min-height: 210px;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  text-align: center;
}

.preview-shell {
  padding: 1rem;
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(243, 238, 228, 0.72));
  box-shadow: var(--shadow-soft);
}

.canvas-wrapper {
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(235, 231, 223, 0.95);
  background:
    linear-gradient(180deg, rgba(248, 246, 242, 0.9), rgba(255, 255, 255, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.canvas-wrapper canvas {
  display: block;
  width: 100%;
  height: auto;
}

.preview-note {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
}

.preset-group {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.preset-option {
  position: relative;
  display: block;
}

.preset-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.preset-option span {
  display: block;
  padding: 0.95rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.84);
  text-align: center;
  font-weight: 700;
  color: var(--text);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.preset-option input:checked + span {
  background: var(--primary-soft);
  border-color: rgba(124, 154, 122, 0.4);
  box-shadow: 0 10px 24px rgba(124, 154, 122, 0.14);
  transform: translateY(-1px);
}

.custom-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field-group {
  display: grid;
  gap: 0.5rem;
}

.field-group label {
  font-weight: 700;
  color: var(--text);
}

.field-group input {
  min-height: 54px;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.field-group input:focus {
  outline: 2px solid rgba(124, 154, 122, 0.18);
  border-color: rgba(124, 154, 122, 0.45);
}

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

.stat {
  padding: 1.15rem 1.2rem;
  border-radius: 22px;
  background: rgba(243, 238, 228, 0.72);
  border: 1px solid rgba(235, 231, 223, 0.9);
}

.stat strong {
  display: block;
  margin-top: 0.15rem;
  font-family: "Nunito", sans-serif;
  font-size: 1.15rem;
}

.tool-actions {
  display: grid;
  gap: 1rem;
  margin-top: 0.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  padding: 0.9rem 1.35rem;
  border: 0;
  border-radius: 999px;
  font-family: "Nunito", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease,
    background 180ms ease;
}

.button--primary {
  color: #ffffff;
  background: linear-gradient(135deg, #6f8f6d 0%, #87a684 100%);
  box-shadow: 0 18px 36px rgba(124, 154, 122, 0.28);
}

.button:hover:enabled,
.button:focus-visible:enabled {
  transform: translateY(-2px);
  box-shadow: 0 22px 40px rgba(124, 154, 122, 0.32);
}

.button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.loading {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

.loading__spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid rgba(124, 154, 122, 0.18);
  border-top-color: var(--primary);
  animation: spin 0.85s linear infinite;
}

.faq-section,
.guide-section {
  display: grid;
  gap: 0;
}

.faq-list {
  display: grid;
  gap: 0.85rem;
}

.faq-list details {
  padding: 1.15rem 1.2rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(235, 231, 223, 0.88);
}

.faq-list summary {
  cursor: pointer;
  list-style: none;
  font-family: "Nunito", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list p {
  margin: 0.75rem 0 0;
  line-height: 1.6;
}

.steps-list {
  margin: 0;
  padding-left: 1.3rem;
  line-height: 1.7;
}

.steps-list li + li {
  margin-top: 0.6rem;
}

.footer {
  padding: 4rem 0 0.5rem;
  text-align: center;
}

.footer p {
  margin: 0;
  font-family: "Nunito", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(calc(100% - 1rem), var(--container));
    padding-top: 1.2rem;
  }

  .hero {
    padding: 2rem 0 3rem;
  }

  h1 {
    max-width: none;
    font-size: clamp(2.3rem, 11vw, 3.8rem);
  }

  .main-flow {
    gap: 3rem;
  }

  .tool-card {
    padding: 1.15rem;
    border-radius: 28px;
  }

  .tool-section + .tool-section {
    margin-top: 2.25rem;
    padding-top: 2.2rem;
  }

  .upload-box {
    min-height: 250px;
    padding: 1.5rem;
    border-radius: 28px;
  }

  .upload-box__icon {
    width: 72px;
    height: 72px;
    font-size: 2.2rem;
  }

  .preset-group,
  .custom-controls,
  .stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .preset-group,
  .custom-controls,
  .stats {
    grid-template-columns: 1fr;
  }

  .preview-shell {
    padding: 0.7rem;
    border-radius: 26px;
  }

  .canvas-wrapper {
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
