.help-dialog {
  width: min(720px, calc(100% - 24px));
  max-width: 720px;
  max-height: min(88vh, 860px);
  max-height: min(88dvh, 860px);
  padding: 0;
  overflow: hidden;
  border: 1px solid #958c75;
  border-radius: 16px;
  background: #fbf8ef;
  color: #253a31;
  box-shadow: 0 24px 70px rgb(24 38 29 / 24%);
}

.help-dialog::backdrop {
  background: rgb(26 38 31 / 48%);
  backdrop-filter: blur(3px);
}

.help-dialog__panel {
  display: flex;
  max-height: min(88vh, 860px);
  max-height: min(88dvh, 860px);
  flex-direction: column;
}

.help-dialog__header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid #d7d1c2;
  background: #fbf8ef;
}

.help-dialog__eyebrow {
  margin: 0 0 4px;
  color: #4e6758;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.help-dialog__title {
  margin: 0;
  color: #253a31;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.help-dialog__close {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #8a826d;
  border-radius: 50%;
  background: #fffaf0;
  color: #253a31;
  cursor: pointer;
  font: inherit;
  font-size: 27px;
  line-height: 1;
}

.help-dialog__content {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 28px 30px;
  scrollbar-gutter: stable;
}

.help-dialog__intro,
.help-dialog__section p,
.help-dialog__section li {
  color: #3f564a;
  font-size: 17px;
  line-height: 1.55;
}

.help-dialog__intro {
  margin: 0 0 24px;
  font-size: 18px;
}

.help-dialog__section {
  margin: 0 0 25px;
}

.help-dialog__section:last-child {
  margin-bottom: 0;
}

.help-dialog__section h3 {
  margin: 0 0 10px;
  color: #253a31;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.help-dialog__section ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 21px;
}

.help-dialog__section li::marker {
  color: #638871;
}

.help-dialog__section strong {
  color: #253a31;
  font-weight: 700;
}

.help-dialog__faq {
  padding: 13px 0;
  border-top: 1px solid #d7d1c2;
}

.help-dialog__faq summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 8px 0;
  color: #253a31;
  cursor: pointer;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.5;
}

.help-dialog__faq p {
  margin: 8px 0 0;
}

.help-dialog__feedback {
  padding-top: 20px;
  border-top: 1px solid #d7d1c2;
}

.help-dialog__feedback > p:first-of-type {
  margin: 0 0 16px;
}

.help-dialog__label {
  display: block;
  margin: 13px 0 7px;
  color: #253a31;
  font-size: 16px;
  font-weight: 700;
}

.help-dialog__textarea {
  width: 100%;
  min-height: 94px;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid #5d7064;
  border-radius: 10px;
  background: #fffdf7;
  color: #253a31;
  font: inherit;
  font-size: 17px;
  line-height: 1.5;
}

.help-dialog__textarea::placeholder {
  color: #51645a;
}

.help-dialog__preview {
  min-height: 145px;
  background: #f3f0e5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.help-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.help-dialog__action {
  min-height: 52px;
  padding: 9px 14px;
  border: 1px solid #5d7064;
  border-radius: 10px;
  background: #fffdf7;
  color: #1c3e32;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
}

.help-dialog__action:hover,
.help-dialog__close:hover {
  background: #eee9dc;
}

.help-dialog__status {
  min-height: 1.5em;
  margin: 9px 0 0;
  color: #345b4b;
  font-size: 15px;
  line-height: 1.5;
}

.help-dialog__note {
  margin: 7px 0 0;
  color: #3f564a;
  font-size: 15px;
  line-height: 1.5;
}

.help-dialog__diagram {
  width: min(100%, 360px);
  margin: 18px auto;
  padding: 12px;
  border: 1px solid #c9c2b1;
  border-radius: 12px;
  background: #f2eee2;
  text-align: center;
}

.help-dialog__diagram svg {
  width: min(100%, 300px);
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.help-dialog__diagram figcaption {
  color: #3f564a;
  font-size: 15px;
  line-height: 1.4;
}

.help-dialog__matching-examples {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.help-dialog__match-example {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 12px 8px;
  border: 1px solid #c9c2b1;
  border-radius: 11px;
  background: #f6f2e7;
  color: #253a31;
  text-align: center;
}

.help-dialog__match-example strong {
  font-size: 16px;
  line-height: 1.35;
}

.help-dialog__match-faces {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.help-dialog__match-faces [role="img"] {
  width: 48px;
  height: 62px;
  display: block;
  overflow: hidden;
  border: 1px solid #8a826d;
  border-radius: 6px;
  background: #fff9e9;
  box-shadow: 0 3px 0 #c4bca5;
}

.help-dialog__match-faces svg {
  width: 100%;
  height: 100%;
  display: block;
}

.help-dialog__privacy {
  margin: 20px 0 0 !important;
  padding-top: 15px;
  border-top: 1px solid #d7d1c2;
  font-size: 16px !important;
}

.help-dialog__privacy a {
  color: #1c3e32;
  font-weight: 700;
  text-underline-offset: 3px;
}

.help-dialog :focus-visible {
  outline: 3px solid #153f6e;
  outline-offset: 3px;
}

@media (max-width: 520px) {
  .help-dialog {
    width: calc(100% - 16px);
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 17px;
  }

  .help-dialog__panel {
    max-height: 92vh;
    max-height: 92dvh;
  }

  .help-dialog__header {
    padding: 17px 18px 14px;
  }

  .help-dialog__content {
    padding: 20px 18px 24px;
  }

  .help-dialog__action {
    flex: 1 1 135px;
  }

  .help-dialog__matching-examples {
    grid-template-columns: 1fr;
  }
}
