.try-it-on-block {
  --try-it-on-ink: #171717;
  --try-it-on-paper: #ffffff;
  --try-it-on-accent-start: #4338ca;
  --try-it-on-accent-end: #7c3aed;
  margin-block: 1rem;
}

.try-it-on-trigger,
.try-it-on-modal__close {
  font: inherit;
}

.try-it-on-trigger {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  max-width: 250px;
  min-height: 3.5rem;
  padding: 0.85rem 1.4rem;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.22);
  border-radius: 0.9rem;
  -webkit-appearance: none;
  appearance: none;
  background:
    radial-gradient(circle at 18% -30%, rgb(255 255 255 / 0.38), transparent 42%),
    linear-gradient(135deg, var(--try-it-on-accent-start), var(--try-it-on-accent-end));
  color: var(--try-it-on-paper);
  box-shadow:
    0 10px 24px rgb(79 70 229 / 0.28),
    inset 0 1px 0 rgb(255 255 255 / 0.22);
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.try-it-on-trigger::after {
  position: absolute;
  z-index: 0;
  inset: -1px;
  background: linear-gradient(110deg, transparent 18%, rgb(255 255 255 / 0.2) 42%, transparent 66%);
  content: "";
  pointer-events: none;
  transform: translateX(-120%);
  transition: transform 520ms ease;
}

.try-it-on-trigger__icon {
  position: relative;
  z-index: 1;
  display: inline-grid;
  flex: 0 0 auto;
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 0.58rem;
  background: rgb(255 255 255 / 0.14);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.16);
  place-items: center;
}

.try-it-on-trigger__icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.try-it-on-trigger__label {
  position: relative;
  z-index: 1;
}

.try-it-on-trigger:hover {
  box-shadow:
    0 14px 30px rgb(79 70 229 / 0.34),
    inset 0 1px 0 rgb(255 255 255 / 0.26);
  transform: translateY(-2px);
}

.try-it-on-trigger:hover::after {
  transform: translateX(120%);
}

.try-it-on-trigger:active {
  box-shadow:
    0 7px 18px rgb(79 70 229 / 0.25),
    inset 0 1px 0 rgb(255 255 255 / 0.2);
  transform: translateY(0) scale(0.99);
}

/* Keep legacy Outline blocks light when a saved theme is upgraded. */
.try-it-on-block--plain .try-it-on-trigger,
.try-it-on-block--outline .try-it-on-trigger {
  border-color: #cbd5e1;
  border-radius: 0.65rem;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
  font-weight: 600;
}

.try-it-on-block--plain .try-it-on-trigger::after,
.try-it-on-block--outline .try-it-on-trigger::after,
.try-it-on-block--plain .try-it-on-trigger__icon,
.try-it-on-block--outline .try-it-on-trigger__icon {
  display: none;
}

.try-it-on-block--plain .try-it-on-trigger:hover,
.try-it-on-block--outline .try-it-on-trigger:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgb(15 23 42 / 0.1);
  transform: translateY(-1px);
}

.try-it-on-block--plain .try-it-on-trigger:active,
.try-it-on-block--outline .try-it-on-trigger:active {
  background: #f1f5f9;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08);
  transform: translateY(0);
}

.try-it-on-trigger:focus-visible,
.try-it-on-modal__close:focus-visible {
  outline: 3px solid #7c3aed;
  outline-offset: 3px;
}

.try-it-on-modal {
  width: min(94vw, 62rem);
  max-width: none;
  height: min(92dvh, 58rem);
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0.75rem;
  background: var(--try-it-on-paper);
  color: var(--try-it-on-ink);
  overflow: hidden;
}

.try-it-on-modal::backdrop {
  background: rgb(0 0 0 / 0.66);
}

.try-it-on-modal__panel {
  position: relative;
  display: flex;
  height: 100%;
  min-height: 0;
}

.try-it-on-modal__status {
  margin: 0;
}

.try-it-on-modal__body {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: #fafafa;
}

.try-it-on-modal__body > * {
  grid-area: 1 / 1;
}

.try-it-on-modal__status {
  display: grid;
  height: 100%;
  padding: 1rem;
  text-align: center;
  place-items: center;
}

.try-it-on-modal__status[hidden] {
  display: none;
}

.try-it-on-modal__close {
  position: absolute;
  z-index: 3;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: inherit;
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.14);
  place-items: center;
  cursor: pointer;
  font-size: 1.75rem;
  line-height: 1;
}

.try-it-on-modal__frame {
  display: block;
  width: 100%;
  height: 100% !important;
  min-height: 0;
  max-height: none;
  border: 0;
  background: #fafafa;
}

@media (max-width: 640px) {
  .try-it-on-modal {
    width: 100%;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .try-it-on-trigger {
    transition: none;
  }

  .try-it-on-trigger::after {
    display: none;
  }
}
