.homePopupOverlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.48);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.homePopupOverlay.active {
  display: flex;
  opacity: 1;
}

.homePopupModal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(var(--home-popup-width, 640px), calc(100vw - 48px));
  max-height: min(var(--home-popup-height, 720px), calc(100vh - 48px));
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  transform: translateY(22px) scale(0.98);
  transition: transform 0.24s ease;
}

.homePopupOverlay.active .homePopupModal {
  transform: translateY(0) scale(1);
}

.homePopupHeader {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: start;
  padding: 28px 30px 18px;
}

.homePopupMeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.homePopupBadge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  color: #fff;
  background: var(--main);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.homePopupCounter {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: rgba(17, 17, 17, 0.6);
  background: #f3f4f5;
  font-size: 12px;
  font-weight: 800;
}

.homePopupTitle {
  color: #111;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.04em;
  word-break: keep-all;
}

.homePopupSummary {
  margin-top: 9px;
  color: rgba(17, 17, 17, 0.58);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  word-break: keep-all;
}

.homePopupIconButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #111;
  background: #f3f4f5;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

.homePopupViewport {
  position: relative;
  overflow: hidden;
  min-height: 160px;
}

.homePopupTrack {
  display: flex;
  width: 100%;
  transition: transform 0.28s ease;
}

.homePopupSlide {
  flex: 0 0 100%;
  width: 100%;
  padding: 0 30px 26px;
  overflow-y: auto;
  max-height: calc(min(var(--home-popup-height, 720px), calc(100vh - 48px)) - 178px);
}

.homePopupSlide::-webkit-scrollbar {
  width: 8px;
}

.homePopupSlide::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
}

.homePopupPanel {
  padding: 22px;
  border-radius: 20px;
  background: #f3f4f5;
}

.homePopupImageLink,
.homePopupImageWrap {
  display: block;
  line-height: 0;
}

.homePopupImage {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
}

.homePopupText,
.homePopupMarkdown,
.homePopupHtml {
  color: rgba(17, 17, 17, 0.72);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.75;
  word-break: keep-all;
}

.homePopupText + .homePopupImageWrap,
.homePopupText + .homePopupImageLink,
.homePopupImageWrap + .homePopupText,
.homePopupImageLink + .homePopupText {
  margin-top: 16px;
}

.homePopupMarkdown h1,
.homePopupMarkdown h2,
.homePopupMarkdown h3,
.homePopupHtml h1,
.homePopupHtml h2,
.homePopupHtml h3,
.homePopupText h1,
.homePopupText h2,
.homePopupText h3 {
  margin: 0 0 12px;
  color: #111;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: -0.04em;
}

.homePopupMarkdown h1,
.homePopupHtml h1,
.homePopupText h1 {
  font-size: 28px;
}

.homePopupMarkdown h2,
.homePopupHtml h2,
.homePopupText h2 {
  font-size: 24px;
}

.homePopupMarkdown h3,
.homePopupHtml h3,
.homePopupText h3 {
  font-size: 20px;
}

.homePopupMarkdown p,
.homePopupHtml p,
.homePopupText p {
  margin: 10px 0;
}

.homePopupMarkdown ul,
.homePopupMarkdown ol,
.homePopupHtml ul,
.homePopupHtml ol,
.homePopupText ul,
.homePopupText ol {
  margin: 10px 0;
  padding-left: 20px;
}

.homePopupMarkdown li,
.homePopupHtml li,
.homePopupText li {
  list-style: disc;
  margin: 4px 0;
}

.homePopupMarkdown a,
.homePopupHtml a,
.homePopupText a {
  color: var(--main) !important;
  font-weight: 800;
}

.homePopupMarkdown img,
.homePopupHtml img,
.homePopupText img {
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 16px;
}

.homePopupMarkdown blockquote,
.homePopupHtml blockquote,
.homePopupText blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--main);
  border-radius: 12px;
  background: #fff;
}

.homePopupFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 30px 28px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.homePopupNav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.homePopupArrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #111;
  background: #f3f4f5;
  font-size: 22px;
  font-weight: 900;
}

.homePopupArrow:disabled {
  opacity: 0.35;
  cursor: default !important;
}

.homePopupActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.homePopupHideButton,
.homePopupCloseButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.homePopupHideButton {
  color: #fff !important;
  background: var(--main);
}

.homePopupCloseButton {
  color: #111 !important;
  background: #fff;
  border: 1px solid #d8d8d8;
}

@media screen and (max-width: 700px) {
  .homePopupOverlay {
    padding: 16px;
    align-items: flex-end;
  }

  .homePopupModal {
    width: 100%;
    max-height: calc(100vh - 32px);
    border-radius: 18px;
  }

  .homePopupHeader {
    grid-template-columns: 1fr auto;
    padding: 22px 20px 14px;
  }

  .homePopupHeader .homePopupIconButton {
    grid-column: 2;
    grid-row: 1;
  }

  .homePopupTitle {
    font-size: 24px;
  }

  .homePopupSlide {
    padding: 0 20px 20px;
    max-height: calc(100vh - 238px);
  }

  .homePopupPanel {
    padding: 16px;
    border-radius: 16px;
  }

  .homePopupImage {
    border-radius: 14px;
  }

  .homePopupFooter {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 20px 22px;
  }

  .homePopupNav,
  .homePopupActions {
    justify-content: center;
  }

  .homePopupHideButton,
  .homePopupCloseButton {
    flex: 1 1 100%;
  }
}
