.copy-text {
  position: relative;
  width: 100%;
  margin: 1.75rem 0;
  color: rgb(15 23 42);
  background: var(
    --surface-card,
    linear-gradient(180deg, rgb(255 253 249) 0%, rgb(245 240 231) 100%)
  );
  border: 1px solid var(--surface-card-border, rgb(190 195 178));
  border-radius: var(--radius-xl, 0.75rem);
  box-shadow: var(
    --surface-card-shadow,
    0 10px 22px -22px rgb(72 91 34 / 0.08)
  );
}

.copy-text__content {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 1.15rem 4rem 1.15rem 1.25rem;
  overflow-x: auto;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.copy-text__content code {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font-family: var(
    --font-mono,
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace
  );
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.65;
}

.copy-text__button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: rgb(51 65 85);
  background: linear-gradient(
    180deg,
    rgb(255 255 255 / 0.96) 0%,
    rgb(247 249 242 / 0.94) 100%
  );
  border: 1px solid rgb(198 206 192);
  border-radius: 999px;
  box-shadow: 0 12px 24px -24px rgb(15 23 42 / 0.28);
  cursor: pointer;
  transition:
    color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.copy-text__button:hover {
  color: rgb(var(--brand-accent-rgb, 70 138 45));
  border-color: rgb(var(--brand-accent-soft-rgb, 126 176 95));
  transform: translateY(-1px);
}

.copy-text__button:focus-visible {
  outline: 3px solid rgb(var(--brand-accent-soft-rgb, 126 176 95) / 0.4);
  outline-offset: 3px;
}

.copy-text__button.is-copied {
  color: rgb(var(--brand-accent-rgb, 70 138 45));
  border-color: rgb(var(--brand-accent-soft-rgb, 126 176 95));
}

.copy-text__feedback {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 10;
  width: max-content;
  max-width: 12rem;
  padding: 0.3rem 0.55rem;
  color: white;
  background: rgb(15 23 42);
  border-radius: var(--radius-md, 0.375rem);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.2rem);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.copy-text__feedback:empty {
  padding: 0;
}

.copy-text__feedback:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

.dark .copy-text {
  color: rgb(226 232 240);
  background: linear-gradient(
    180deg,
    rgb(17 21 29 / 0.94) 0%,
    rgb(13 17 23 / 0.9) 100%
  );
  border-color: rgb(58 63 67);
  box-shadow: 0 12px 24px -22px rgb(2 6 23 / 0.6);
}

.dark .copy-text__button {
  color: rgb(226 232 240);
  background: linear-gradient(
    180deg,
    rgb(23 26 28 / 0.96) 0%,
    rgb(19 22 24 / 0.92) 100%
  );
  border-color: rgb(58 63 67);
  box-shadow: 0 12px 24px -24px rgb(2 6 23 / 0.68);
}

.dark .copy-text__button:hover,
.dark .copy-text__button.is-copied {
  color: rgb(var(--brand-accent-soft-rgb, 126 176 95));
  border-color: rgb(var(--brand-accent-rgb, 70 138 45));
}

.dark .copy-text__feedback {
  color: rgb(15 19 24);
  background: rgb(var(--brand-accent-bright-rgb, 197 224 180));
}

@media (max-width: 480px) {
  .copy-text {
    margin: 1.5rem 0;
  }

  .copy-text__content {
    padding: 1rem 3.75rem 1rem 1rem;
  }

  .copy-text__content code {
    font-size: 0.875rem;
  }

  .copy-text__button {
    top: 0.625rem;
    right: 0.625rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .copy-text__button,
  .copy-text__feedback {
    transition: none;
  }
}
