.farcaster-embed-container * {
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0 !important;
}

.farcaster-embed-container {
  position: relative;
  padding: 1.5rem !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.farcaster-embed-container::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  border: 1px solid currentColor;
  border-radius: 1rem;
  opacity: 0.25;
  z-index: -1;
  pointer-events: none;
}

.farcaster-embed-container > div {
  color: inherit;
}

.farcaster-embed-metadata {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-gap: 0.75rem;
  align-items: center;
  line-height: 1.2;
  container: metadata / inline-size;
}

.farcaster-embed-timestamp {
  grid-column: 1 / -1;
  opacity: 0.5;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

@container metadata (min-width: 260px) {
  .farcaster-embed-metadata {
    grid-template-columns: 48px 1.5fr 1fr;
  }

  .farcaster-embed-timestamp {
    grid-column: 3;
    text-align: right;
  }
}

.farcaster-embed-author-avatar-container {
  width: 48px;
  height: 48px;
  border-radius: 100%;
  overflow: hidden;
}

.farcaster-embed-quote-cast-author-avatar-container {
  width: 20px;
  height: 20px;
  border-radius: 100%;
  overflow: hidden;
}

.farcaster-embed-author-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.farcaster-embed-author p {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.farcaster-embed-author-username {
  opacity: 0.5;
}

.farcaster-embed-body {
  margin-top: 1rem !important;
}

.farcaster-embed-body p {
  font-size: 1.125rem;
  line-height: 1.75rem;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.farcaster-embed-image-container:not(:empty) {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem !important;
}

.farcaster-embed-image-link {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 0.375rem;
  overflow: hidden;
  position: relative;
}

.farcaster-embed-image-link::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  box-shadow: inset 0 0 0 1px currentColor;
  border-radius: 0.375rem;
  opacity: 0.25;
  z-index: 1;
  pointer-events: none;
  transition: 0.15s ease opacity;
}

.farcaster-embed-image-link::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  border-radius: 0.375rem;
  opacity: 0.12;
  z-index: -1;
  pointer-events: none;
  background-color: currentColor;
}

.farcaster-embed-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: 0.25s ease-out transform;
}

.farcaster-embed-image-link:hover::before {
  opacity: 0.35;
}

.farcaster-embed-image-link:hover .farcaster-embed-image {
  transform: scale(1.05);
}

.farcaster-embed-urls-container:not(:empty) {
  position: relative;
  display: grid;
  gap: 0.75rem;
  width: 100%;
  margin-top: 0.75rem !important;
}

.farcaster-embed-url-link {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  border-radius: 0.375rem;
  overflow: hidden;
  position: relative;
}

.farcaster-embed-url-link-compact {
  flex-direction: row;
  align-items: center;
}

.farcaster-embed-url-link-compact .farcaster-embed-url-image {
  width: 128px;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 1;
}

.farcaster-embed-url-image {
  display: inline-block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

.farcaster-embed-url-metadata {
  display: flex;
  flex-direction: column;
  padding: 0.75rem !important;
}

.farcaster-embed-url-title {
  font-weight: bold;
}

.farcaster-embed-url-description {
  opacity: 0.75;
  text-wrap: pretty;
  line-height: 1.375;
  font-size: 0.875rem;
  padding-top: 0.35em !important;
}

.farcaster-embed-url-domain {
  font-size: 0.675rem;
  letter-spacing: 0.05em;
  opacity: 0.5;
  text-transform: uppercase;
  padding-top: 0.5em !important;
  transition: 0.15s ease opacity;
}

.farcaster-embed-channel:not(:empty) {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem !important;
  padding-left: calc(0.25rem + 3px) !important;
  margin-top: 0.75rem !important;
  position: relative;
}

.farcaster-embed-channel::before,
.farcaster-embed-url-link::before,
.farcaster-embed-quote-cast::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid currentColor;
  border-radius: 0.375rem;
  opacity: 0.3;
  z-index: -1;
  pointer-events: none;
  transition: 0.15s ease opacity;
}

.farcaster-embed-channel::before {
  left: 0;
  bottom: -1px;
}

.farcaster-embed-url-link::before,
.farcaster-embed-quote-cast::before {
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  z-index: 3;
}

.farcaster-embed-url-link:hover::before {
  opacity: 0.5;
}

.farcaster-embed-url-link:hover .farcaster-embed-url-domain {
  opacity: 1;
}

.farcaster-embed-channel-avatar-container {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  overflow: hidden;
}

.farcaster-embed-channel-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.farcaster-embed-channel-name {
  font-size: 0.875rem;
  line-height: 1.25rem;
  opacity: 0.5;
}

.farcaster-embed-stats {
  /* The counters row is stripped server-side and re-added client-side by the
     live-stats script (LIVE_STATS_SCRIPT in worker/cast-page.tsx); this
     container holds the counters (left) and the Farcaster logo (right). */
  margin-top: 1rem !important;
  margin-bottom: -0.375rem !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.farcaster-embed-stats ul {
  display: flex;
  gap: 1.5rem;
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.farcaster-embed-stats-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  opacity: 0.5;
  color: inherit;
  text-decoration: none;
}

.farcaster-embed-farcaster-icon {
  display: flex;
}

.farcaster-embed-farcaster-link {
  display: inline-block;
  transition: transform 0.15s ease-out;
}

.farcaster-embed-farcaster-link:hover {
  transform: scale(1.1);
}

.farcaster-embed-farcaster-link:active {
  transform: scale(0.95);
}

.farcaster-embed-video-container:not(:empty) {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem !important;
}

.farcaster-embed-container media-control-bar *,
.farcaster-embed-container media-control-bar *::before,
.farcaster-embed-container media-control-bar *::after {
  padding: 0.5rem !important;
  background: transparent !important;
}

.farcaster-embed-video-player,
.farcaster-embed-video-player media-controller {
  width: 100%;
  height: 100%;
}

.farcaster-embed-quote-cast-container:not(:empty) {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem !important;
}

.farcaster-embed-quote-cast {
  position: relative;
}

.farcaster-embed-quote-cast .farcaster-embed-avatar-link {
  display: flex;
  align-items: center;
}

.farcaster-embed-quote-cast .farcaster-embed-author {
  display: flex;
  flex-direction: row;
  column-gap: 0.125em;
  flex-wrap: wrap;
}

.farcaster-embed-quote-cast .farcaster-embed-author p {
  font-size: 0.875rem;
}

.farcaster-embed-quote-cast .farcaster-embed-metadata {
  grid-template-columns: 20px 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.75rem 0.125rem 0.75rem !important;
}

.farcaster-embed-quote-cast .farcaster-embed-timestamp p {
  font-size: 0.75rem;
}

.farcaster-embed-quote-cast .farcaster-embed-body {
  padding: 0.75rem !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
  opacity: 0.75;
}

.farcaster-embed-quote-cast .farcaster-embed-body p {
  font-size: 0.875rem;
  line-height: 1.5;
}
