:root {
  --bg: #f3efe6;
  --bg-elev: #fffcf6;
  --ink: #1c1914;
  --ink-muted: #5c564c;
  --line: #d9d0c0;
  --accent: #0d6b5c;
  --accent-hover: #0a5649;
  --accent-soft: #dceee9;
  --accent-ink: #f3efe6;
  --copy: #1f3d70;
  --copy-hover: #173057;
  --ad: #eae4d6;
  --danger: #8f2d2d;
  --ok: #0d6b5c;
  --radius: 12px;
  --shadow: 0 1px 0 rgba(28, 25, 20, 0.04), 0 12px 32px rgba(28, 25, 20, 0.06);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 40rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, #e4efe8 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
  overflow-wrap: break-word;
}

.wrap {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-header {
  padding: 0 0 1.25rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  padding: 0.7rem 0;
  margin-bottom: 1.1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
}

.topbar.is-stuck {
  border-bottom-color: var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--ink-muted);
}

.brand-link {
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.85rem;
  font-weight: 750;
}

.brand-ru {
  color: var(--accent);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.15rem;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 650;
  touch-action: manipulation;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent-hover);
  background: var(--accent-soft);
  outline: none;
}

.nav-toggle {
  display: none;
  appearance: none;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bars {
  position: relative;
  width: 1.05rem;
  height: 0.85rem;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after,
.nav-toggle-bars {
  background: var(--ink);
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--ink);
}

.nav-toggle-bars {
  background:
    linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat;
}

.nav-toggle-bars::before {
  top: 0;
}

.nav-toggle-bars::after {
  bottom: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
}

.header-hero {
  padding-top: 0.25rem;
}

.site-header h1 {
  margin: 0 0 0.7rem;
  max-width: 18ch;
  font-size: clamp(1.85rem, 4vw, 2.65rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

#how,
#about,
#use-cases,
#faq,
#tool {
  scroll-margin-top: 4.75rem;
}

.lead {
  margin: 0;
  max-width: 46rem;
  color: var(--ink-muted);
}

.lead code {
  font-size: 0.92em;
  padding: 0.05em 0.35em;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2rem;
  align-items: start;
  padding-bottom: 3rem;
}

.shell-main {
  min-width: 0;
}

.tool {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.15rem 1.25rem;
}

.tool-bar {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.95rem;
}

.mode-switch {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border-radius: 999px;
  background: #ece6d8;
}

.mode-switch-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}

.mode-switch-btn.is-active {
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(28, 25, 20, 0.08);
}

.mode-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.15rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}

.check input {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.pane-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.pane-field {
  width: 100%;
  min-height: 22rem;
  resize: vertical;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.55;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(28, 25, 20, 0.03);
}

.pane-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pane-field--out {
  background: #f7f4ec;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1rem;
  padding: 0.15rem 0 0.25rem;
}

.actions-spacer {
  flex: 1 1 8rem;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.72rem 1.05rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-copy {
  background: var(--copy);
  color: #f4f7fb;
}

.btn-copy:hover {
  background: var(--copy-hover);
}

.btn-copy.is-done {
  background: var(--ok);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-muted);
}

.btn-ghost:hover {
  background: #efe9db;
  color: var(--ink);
}

.stats {
  min-height: 1.4em;
  margin: 0.65rem 0 0;
  font-size: 0.86rem;
  color: var(--ink-muted);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-compact {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.mode-switch-btn--secondary {
  font-weight: 600;
}

.report {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4faf7;
}

.report-title,
.diff-title,
.history-title {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.report-list,
.history-list {
  margin: 0;
  padding-left: 1.1rem;
}

.report-list li + li,
.history-list li + li {
  margin-top: 0.2rem;
}

.diff-panel,
.history {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
}

.diff-head,
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.diff-body {
  margin: 0;
  max-height: 18rem;
  overflow: auto;
  padding: 0.7rem;
  border-radius: 8px;
  background: #1c1914;
  color: #f3efe6;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.history-list {
  list-style: none;
  padding-left: 0;
}

.history-list li {
  display: grid;
  gap: 0.15rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
}

.history-list li:first-child {
  border-top: 0;
}

.history-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent-hover);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}

.history-meta {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.link-cards {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.link-cards a {
  display: block;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
}

.link-cards a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  margin: 0.7rem 0;
}

.footer-nav a,
.linkish {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.consent {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
  display: none;
  gap: 0.75rem;
  max-width: 640px;
  margin-inline: auto;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.consent.is-visible {
  display: grid;
}

.consent[hidden] {
  display: none !important;
}

.consent p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.consent-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.legal-page .prose {
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
}

.legal-page h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.crumbs {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.crumbs a {
  color: var(--accent-hover);
}

.desktop-only {
  display: block;
}

.ad-slot {
  border: 1px dashed #cfc6b4;
  background: var(--ad);
  border-radius: 10px;
}

.ad-label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a7264;
}

.ad-slot-inner {
  position: relative;
  display: grid;
  place-items: center;
  color: #8a8273;
  font-size: 0.85rem;
  text-align: center;
}

.ad-slot--lead {
  margin-bottom: 1.1rem;
}

.ad-slot-inner--lead {
  min-height: 90px;
}

.ad-slot--after {
  margin-top: 64px;
}

.ad-slot-inner--after {
  min-height: 250px;
}

.ad-slot--faq {
  margin: 1rem 0;
}

.ad-slot-inner--faq {
  min-height: 120px;
}

.ad-rail {
  position: sticky;
  top: 1rem;
}

.ad-slot-inner--rail {
  min-height: 600px;
}

.prose {
  margin-top: 2.4rem;
  max-width: var(--measure);
}

.prose h2 {
  margin: 0 0 0.85rem;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.steps {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.steps li + li {
  margin-top: 0.45rem;
}

.prose kbd {
  display: inline-block;
  padding: 0.05em 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-elev);
  font-size: 0.82em;
}

.prose details {
  border-top: 1px solid var(--line);
  padding: 0.7rem 0;
}

.prose details:last-child {
  border-bottom: 1px solid var(--line);
}

.prose summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
  touch-action: manipulation;
}

.prose details p {
  margin: 0.55rem 0 0;
  color: var(--ink-muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 2rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0 0 0.4rem;
}

.muted {
  color: #8a8273;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .ad-rail {
    display: none;
  }
}

@media (max-width: 780px) {
  .wrap {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    padding: 0 0 1rem;
  }

  .topbar {
    position: sticky;
    top: 0;
    margin-bottom: 0.85rem;
    padding: 0.55rem 0;
    row-gap: 0.45rem;
  }

  .brand {
    margin-bottom: 0;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .site-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.35rem 0 0.15rem;
  }

  .topbar.is-open .site-nav {
    display: flex;
  }

  .site-nav a {
    width: 100%;
    min-height: 48px;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-elev);
    font-size: 1rem;
  }

  .site-header h1 {
    max-width: none;
    font-size: clamp(1.7rem, 8vw, 2.15rem);
  }

  .lead {
    font-size: 0.98rem;
  }

  .shell {
    gap: 0;
    padding-bottom: 2rem;
  }

  .ad-slot--lead {
    margin-bottom: 0.75rem;
  }

  .ad-slot-inner--lead {
    min-height: 72px;
  }

  .tool {
    padding: 0.85rem;
    border-radius: 12px;
  }

  .mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .mode-switch-btn {
    min-width: 0;
    min-height: 44px;
    padding: 0.5rem 0.55rem;
    font-size: 0.84rem;
    line-height: 1.2;
  }

  .mode-hint {
    line-height: 1.4;
  }

  .options {
    display: grid;
    gap: 0.1rem;
  }

  .check {
    width: 100%;
    padding: 0.15rem 0;
    line-height: 1.3;
  }

  .panes {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .pane-field {
    min-height: 13rem;
    max-height: 65dvh;
    padding: 0.75rem;
    font-size: 16px;
    resize: vertical;
  }

  .actions-spacer {
    display: none;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .btn {
    width: 100%;
    padding-inline: 0.65rem;
  }

  .btn-primary,
  .btn-copy {
    grid-column: 1 / -1;
  }

  .desktop-only {
    display: none;
  }

  .consent {
    left: 8px;
    right: 8px;
  }

  .stats {
    min-height: 2.7em;
    line-height: 1.35;
  }

  .ad-slot--after {
    margin-top: 64px;
  }

  .ad-slot-inner--after {
    min-height: 250px;
  }

  .prose {
    margin-top: 2rem;
  }

  .prose details {
    padding-block: 0.45rem;
  }

  .site-footer {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .wrap {
    width: min(100% - 16px, 1180px);
  }

  .tool {
    padding: 0.7rem;
  }

  .mode-switch-btn {
    font-size: 0.78rem;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .btn-primary {
    order: -2;
  }

  .btn-copy {
    order: -1;
  }

  .pane-field {
    min-height: 12rem;
  }
}

@media (hover: none) {
  .btn-primary:hover {
    background: var(--accent);
  }

  .btn-copy:hover {
    background: var(--copy);
  }

  .btn-ghost:hover {
    background: transparent;
    color: var(--ink-muted);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .mode-switch-btn {
    transition: none;
  }
}
