.ncg-wrapper,
.ncg-wrapper * {
  box-sizing: border-box;
}

.ncg-wrapper {
  /*
   * Use real transparent space rather than a bottom margin. Gutenberg can
   * collapse the final child margin of Shortcode output, which made managed
   * v2 generators sit too close to the following Best Names group. Padding
   * is part of the wrapper box and therefore cannot collapse.
   */
  margin: 30px 0 0;
  padding-bottom: 60px;
}

.ncg-generator {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 22px;
  overflow: hidden;
  color: #2c3e50;
  font-family: inherit;
  background-color: rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  isolation: isolate;
}

/*
 * Real image element rather than a CSS background. This matches the existing
 * NamesCubed Generator Background Image plugin and remains visible when dark-
 * mode extensions suppress CSS background images. The legacy plugin sees the
 * nc-universal-generator-image class and therefore will not insert a duplicate.
 */
.ncg-background-image,
.ncg-generator > .nc-universal-generator-image {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  object-position: center;
  opacity: 0.7;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.ncg-generator::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.52);
  pointer-events: none;
}

/*
 * Established NamesCubed golden hover treatment. The real background image
 * stays visible beneath the permanent white readability layer; hovering the
 * generator adds the warm gold radial highlight used by the legacy template.
 */
.ncg-generator::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    circle at top left,
    rgba(255, 223, 142, 0.3),
    rgba(255, 215, 0, 0.15)
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ncg-generator:hover::after {
  opacity: 1;
}

.ncg-heading {
  text-align: center;
  margin-bottom: 20px;
}

.ncg-title {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
}

.ncg-description {
  margin: 0 auto;
  max-width: 680px;
}

.ncg-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.ncg-filter-selection {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(248, 249, 250, 0.96);
  border-radius: 18px;
}

.ncg-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  white-space: nowrap;
  cursor: pointer;
}

.ncg-category-input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #e3b448;
}

.ncg-generate-btn {
  min-height: 44px;
  padding: 12px 25px;
  color: #2c3e50;
  font: inherit;
  font-weight: 700;
  background: #e3b448;
  border: 0;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.ncg-generate-btn:hover {
  background: #c9a03d;
  transform: translateY(-1px);
}

.ncg-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.ncg-name-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  min-height: 58px;
  padding: 13px 15px 13px 20px;
  background: rgba(248, 249, 250, 0.97);
  border-radius: 8px;
}

.ncg-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.08em;
  font-weight: 600;
}

/*
 * Match the pale-blue NamesCubed pill treatment used elsewhere on the site.
 * The solid site blue is reserved for the brief successful-copy state.
 */
.ncg-copy-btn {
  flex: 0 0 auto;
  min-width: 3.6rem;
  min-height: 38px;
  padding: 8px 15px;
  color: #171717;
  font: inherit;
  font-size: 0.9em;
  font-weight: 500;
  background: #e5f0f3;
  border: 1px solid #8fb4c2;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.ncg-copy-btn:hover {
  background: #d8e9ee;
  border-color: #4e8499;
  color: #171717;
  box-shadow: 0 3px 10px rgba(78, 132, 153, 0.12);
}

.ncg-copy-btn:active {
  transform: translateY(1px);
}

.ncg-copy-btn.ncg-copied {
  background: #4e8499;
  border-color: #4e8499;
  color: #ffffff;
  font-weight: 600;
}

.ncg-category-input:focus-visible,
.ncg-generate-btn:focus-visible {
  outline: 3px solid #2c3e50;
  outline-offset: 3px;
}

.ncg-copy-btn:focus-visible {
  outline: 2px solid #4e8499;
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .ncg-generator {
    padding: 16px;
  }

  .ncg-background-image,
  .ncg-generator > .nc-universal-generator-image {
    object-fit: fill;
    object-position: center;
  }

  .ncg-filter-selection {
    width: 100%;
    justify-content: flex-start;
    border-radius: 12px;
  }

  .ncg-name-card {
    padding: 12px 13px;
  }

  .ncg-copy-btn {
    min-width: 3.2rem;
    padding: 7px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ncg-generator::after,
  .ncg-generate-btn,
  .ncg-copy-btn {
    transition: none;
  }
}

/*
 * v0.4.3 added this marker while diagnosing Gutenberg shortcode spacing.
 * Keep it for backwards compatibility, but v0.4.4 no longer relies on a
 * frontend Shortcode wrapper: the reliable gap is the padding on .ncg-wrapper.
 */
.ncg-shortcode-block {
  margin-bottom: 0 !important;
}

/*
 * The spacing now lives on .ncg-wrapper as non-collapsing padding. Keep the
 * block class for backwards compatibility, but do not add a second gap.
 */
@supports selector(.wp-block-shortcode:has(> .ncg-wrapper)) {
  .wp-block-shortcode:has(> .ncg-wrapper) {
    margin-bottom: 0 !important;
  }
}
