#nsaionai-root { display: contents; }

.nsaionai-overlay {
  --nsaionai-top-space: 106px;
  --nsaionai-bottom-space: 22px;
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483647 !important;
  align-items: flex-start;
  justify-content: center;
  padding: var(--nsaionai-top-space) 24px var(--nsaionai-bottom-space);
  box-sizing: border-box;
  overflow: hidden;
  background: rgba(0,0,0,.55);
}
.nsaionai-overlay.is-open { display: flex !important; }
.admin-bar .nsaionai-overlay {
  top: var(--wp-admin--admin-bar--height, 32px);
  height: calc(100vh - var(--wp-admin--admin-bar--height, 32px));
  height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px));
}
.admin-bar #wpadminbar,
.admin-bar .trp-language-switcher,
.admin-bar .wpml-ls,
.admin-bar #trp-floater-ls,
.admin-bar .translatepress-language-switcher {
  z-index: 2147483647 !important;
}
html.nsaionai-lock,
html.nsaionai-lock body { overflow: hidden !important; }

.nsaionai-overlay *,
.nsaionai-overlay *::before,
.nsaionai-overlay *::after { box-sizing: border-box; }

.nsaionai-dialog {
  position: relative;
  width: min(1320px, calc(100vw - 112px));
  max-height: calc(100vh - var(--nsaionai-top-space) - var(--nsaionai-bottom-space));
  max-height: calc(100dvh - var(--nsaionai-top-space) - var(--nsaionai-bottom-space));
  overflow: visible;
  border-radius: 14px;
  background: transparent;
  color: #222b3f;
  font-family: var(--nsaionai-body-font, inherit); /* theme paragraph font */
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: normal;
  isolation: isolate;
}
.admin-bar .nsaionai-dialog {
  max-height: calc(100vh - var(--wp-admin--admin-bar--height, 32px) - var(--nsaionai-top-space) - var(--nsaionai-bottom-space));
  max-height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px) - var(--nsaionai-top-space) - var(--nsaionai-bottom-space));
}
.nsaionai-dialog::before {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: -1;
  border-radius: 14px;
  background: rgba(207,207,207,.88);
  filter: blur(5px);
}

.nsaionai-scroll {
  position: relative;
  z-index: 1;
  max-height: inherit;
  padding: 18px 34px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 14px;
  background: #cfcfcf;
  scrollbar-width: thin;
}
.nsaionai-scroll::before {
  content: "";
  position: absolute;
  inset: 12px 18px;
  z-index: 0;
  pointer-events: none;
  background-image: var(--nsaionai-watermark-image, none);
  background-repeat: no-repeat;
  background-position: center 48%;
  background-size: var(--nsaionai-watermark-size, 72%);
  opacity: var(--nsaionai-watermark-opacity, .22);
}
.nsaionai-inner {
  position: relative;
  z-index: 1;
  min-width: 0;
  color: #222b3f;
}

.nsaionai-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 5;
  width: 28px;
  height: 28px;
  padding: 0;
  border-width: 0;
  border-radius: 50%;
  background-color: transparent;
  color: #555;
  font: 400 24px/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
  box-shadow: none;
  text-align: center;
  transition: background .2s, color .2s;
  -webkit-appearance: none;
  appearance: none;
}
.nsaionai-close:hover,
.nsaionai-close:focus { color: #0d1530; background: rgba(255,255,255,.25); outline: none; }

.nsaionai-title {
  margin: 0 42px 0.12em 0;
  color: #0d1530;
  font-family: "Special Elite", "Courier New", Courier, monospace;
  font-weight: 400;
  font-size: clamp(31px, 2.55vw, 40px);
  line-height: 1.04;
  letter-spacing: .01em;
}
.nsaionai-intro {
  max-width: none;
  margin: 0 0 1.7em;
  color: #222b3f;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
}

.nsaionai-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 58px;
  align-items: start;
  min-width: 0;
}
.nsaionai-item {
  min-width: 0;
  color: #222b3f;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
}
.nsaionai-model {
  margin: 0 0 0.75em;
  color: #0d1530;
  font-family: "Special Elite", "Courier New", Courier, monospace;
  font-size: clamp(21px, 1.55vw, 26px);
  line-height: 1.04;
  font-weight: 400;
  letter-spacing: .01em;
}
.nsaionai-model-name { display: inline; }
.nsaionai-date {
  display: inline-block;
  margin-left: 10px;
  color: rgba(34,43,63,.62);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: 0;
  vertical-align: baseline;
  white-space: nowrap;
}
.nsaionai-content {
  color: #222b3f;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  max-width: 100%;
}
.nsaionai-content :where(p, ul, ol, li, blockquote, h1, h2, h3, h4, h5, h6) {
  font-family: inherit;
  color: inherit;
  max-width: 100%;
}
.nsaionai-content :where(p:empty) { display: none; }
.nsaionai-content :where(strong, b) { font-weight: 700; color: inherit; }
.nsaionai-content :where(img, iframe, table) { max-width: 100%; }

/* ------------------------------------------------------------------ */
/* Self-contained vertical rhythm.                                     */
/* The popup is injected into the page body, so theme CSS cascades in. */
/* Every margin below is stated explicitly (with .nsaionai-overlay for */
/* specificity) so the popup does not inherit the theme's spacing.     */
/* ------------------------------------------------------------------ */
.nsaionai-overlay .nsaionai-intro p,
.nsaionai-overlay .nsaionai-content p {
  margin: 0 0 0.85em;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
}
.nsaionai-overlay .nsaionai-content ul,
.nsaionai-overlay .nsaionai-content ol {
  margin: 0.2em 0 0.9em !important;
  padding: 0 0 0 1.3em !important;
}
.nsaionai-overlay .nsaionai-content ul { list-style: disc outside !important; }
.nsaionai-overlay .nsaionai-content p + ul,
.nsaionai-overlay .nsaionai-content p + ol { margin-top: -0.5em !important; }
.nsaionai-overlay .nsaionai-content ol { list-style: decimal outside !important; }
.nsaionai-overlay .nsaionai-content ul ul,
.nsaionai-overlay .nsaionai-content ol ol,
.nsaionai-overlay .nsaionai-content ul ol,
.nsaionai-overlay .nsaionai-content ol ul {
  margin: 0.3em 0 0.3em;
}
.nsaionai-overlay .nsaionai-content li {
  margin: 0 !important;
  padding: 0 !important;
  font-size: inherit;
  line-height: inherit;
  list-style: inherit !important;
  display: list-item !important;
}
.nsaionai-overlay .nsaionai-content li::marker { color: rgba(34,43,63,.7); }
.nsaionai-overlay .nsaionai-content blockquote {
  margin: 0.2em 0 0.9em;
  padding: 0.1em 0 0.1em 0.9em;
  border-left: 3px solid rgba(34,43,63,.28);
  font-style: italic;
}
.nsaionai-overlay .nsaionai-content :where(h1, h2, h3, h4, h5, h6) {
  margin: 1.1em 0 0.4em;
  padding: 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
}

/* Pin the gaps around the plugin's own headings, theme-proof. */
.nsaionai-overlay .nsaionai-title { margin: 0 42px 0.12em 0; padding: 0; }
.nsaionai-overlay .nsaionai-intro { margin: 0 0 1.7em; padding: 0; }
.nsaionai-overlay h2.nsaionai-model { margin: 0 0 0.75em; padding: 0; }
.nsaionai-overlay .nsaionai-content { margin: 0; padding: 0; }

/* Keep normal HTML flow inside rich text, but prevent first/last child margins
   from adding artificial space at wrapper boundaries. The heading -> content
   gap is controlled solely by .nsaionai-model's bottom margin. */
.nsaionai-overlay .nsaionai-intro > :first-child,
.nsaionai-overlay .nsaionai-content > :first-child { margin-top: 0 !important; }
.nsaionai-overlay .nsaionai-intro > :last-child,
.nsaionai-overlay .nsaionai-content > :last-child { margin-bottom: 0 !important; }

.nsaionai-loading {
  position: relative;
  width: min(420px, calc(100vw - 64px));
  min-height: 120px;
  padding: 28px 34px;
  border-radius: 14px;
  color: #222b3f;
  font-family: inherit;
  background: #cfcfcf;
}
.nsaionai-loading::before {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: -1;
  border-radius: 14px;
  background: rgba(207,207,207,.88);
  filter: blur(5px);
}

@media (max-width: 1050px) {
  .nsaionai-dialog { width: min(820px, calc(100vw - 40px)); }
  .nsaionai-scroll { padding: 20px 28px 26px; }
  .nsaionai-grid { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 782px) {
  .admin-bar .nsaionai-overlay {
    top: 46px;
    height: calc(100vh - 46px);
    height: calc(100dvh - 46px);
  }
  .admin-bar .nsaionai-dialog {
    max-height: calc(100vh - 46px - var(--nsaionai-top-space) - var(--nsaionai-bottom-space));
    max-height: calc(100dvh - 46px - var(--nsaionai-top-space) - var(--nsaionai-bottom-space));
  }
}
@media (max-width: 640px) {
  .nsaionai-overlay { --nsaionai-top-space: 74px; padding-left: 14px; padding-right: 14px; }
  .nsaionai-dialog { width: calc(100vw - 28px); }
  .nsaionai-scroll { padding: 20px 20px 24px; }
  .nsaionai-title { font-size: 34px !important; }
  .nsaionai-intro { font-size: 14px !important; }
  .nsaionai-item, .nsaionai-content p, .nsaionai-content li { font-size: 14px !important; }
}
@media (max-height: 620px) {
  .nsaionai-overlay { --nsaionai-top-space: 72px; --nsaionai-bottom-space: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .nsaionai-close { transition: none; }
}
